Skip to content

[BUG] Offline channel does not recover from offline => online transition when initially offline #2674

@peitschie

Description

@peitschie

Description/Screenshot

I've discovered that the offline channel never sends the stored messages if the page is initially offline on launch (this is being used inside of a cordova SPA).

The culprit seems to be this line here, where the isOnline state is captured only once ever, and the timer then incorrectly always decides it is offline: https://github.com/microsoft/ApplicationInsights-JS/blob/main/channels/offline-channel-js/src/OfflineChannel.ts#L444

Steps to Reproduce

Launching the page using the exact instructions as per https://github.com/microsoft/ApplicationInsights-JS/tree/main/channels/offline-channel-js, but with navigator.isOnline reporting false

"@microsoft/applicationinsights-offlinechannel-js": "^0.3.10",
"@microsoft/applicationinsights-web": "^3.3.10",

Expected behavior

Ideally the messages are sent when the network is restored 😁

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions