You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
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.ApplicationInsights-JS/channels/applicationinsights-channel-js/src/Offline.ts
Line 17 in 22d3787
ApplicationInsights-JS/channels/applicationinsights-channel-js/src/Sender.ts
Line 387 in 22d3787
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
andoffline
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 caseSuggested Fix
Initialize
_onlineStatus
by evaulating the status of the network, using a browser hook such aswindow.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.The text was updated successfully, but these errors were encountered: