Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Telemetry Buffer Getting Cleared in Offline Mode - Online Status Incorrectly Initialized in Offline Listener #1538

Closed
davesauce14 opened this issue Apr 21, 2021 · 2 comments
Assignees
Milestone

Comments

@davesauce14
Copy link

Behavior

In the scenario for progressive webapps the telemetry buffer is not being preserved during offline mode.

Culprit

This is happening because, in the constructor for OnlineListener, we initialize _onlineStatus = true.
Which prevents the Sender._xhrReadyStateChange event handler from adding it back to the telem buffer after failure.

} else if (Offline.isOffline()) { // offline

This logic will be sufficent in most scenarios since the initial GET request, would have to have been fetched over the wire for application insights to have been invoked.
But in the case of PWAs we would have this cached, and initialization would happen, even though we are offline.
Initializing to true is not sufficient.

Additional notes

The hooks for detecting network changes: online and offline are working successfully, I have tested these!
But that will only re-evaluate the _onlineStatus if the status of the network has changed, after the application was loaded, which may not be the case

Suggested Fix

Initialize _onlineStatus by evaulating the status of the network, using a browser hook such as window.navigator.online

Steps to recreate

Open a PWA when the application is in offline mode.
You will see that OfflineListener._onlineStatus is true and telemetry buffer is not being preserved.

@MSNev MSNev self-assigned this Apr 21, 2021
@MSNev MSNev added the bug label Apr 21, 2021
@MSNev MSNev added this to the 2.6.2 milestone Apr 21, 2021
MSNev added a commit that referenced this issue Apr 21, 2021
MSNev added a commit that referenced this issue Apr 22, 2021
@MSNev MSNev added fixed - waiting release PR Committed and waiting deployment released - NPM waiting - CDN deployment and removed fixed - waiting release PR Committed and waiting deployment waiting - CDN deployment labels Apr 22, 2021
@MSNev
Copy link
Collaborator

MSNev commented Apr 27, 2021

v2.6.2 is now fully deployed

@MSNev MSNev closed this as completed Apr 27, 2021
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants