-
Notifications
You must be signed in to change notification settings - Fork 237
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] App insight library will flush telemetry using beforeUnload event but this event is cancellable #1516
Comments
Historically, having both beforeunload and pagehide is required to ensure that we can flush events in all environments, as not all of the supported runtimes (browser, mobile devices, etc) you have however, identified an issue in that we should also be listening to the "unload" event... Will raise a new bug for that. At what point are you tagging the events with "IsPageUnloading"? If you want to control the level for when the events are flushed, the workaround I would suggest is as follows, as while we will add the unload event we won't be removing before unload due to potential backward compatibility issues.
|
As mentioned above raised new bug to more correctly track all unload events in all environments #1517 |
thanks for the suggestion @MSNev, it makes sense, I'll try out what you said, to let our app control when we want app insights to unload.
We were previously using |
@MSNev related bug, I found that adding
appInsightsInstance.appInsights.config.disableFlushOnBeforeUnload is still undefined . I can however find the config that I want to pass in appInsightsInstance.config.disableFlushOnBeforeUnload
I found that in the creation of
Config:
|
I got the same issue with |
Investigating the disableFlushOnBeforeUnload issue |
Ok, I've identified the issue with the config. Simplistically, depending on the version of the snippet that is used this initializes different base objects.
This looks like it's been broken like this for a while (so not going to elevate this to a P1), but linking to #1517 as there is a bunch of code that needs fixing here to restore compatibility. Linking #1517 as there is a bunch of code that is required to be fixed, also created a new bug to explicitly call out the 2 disable config items #1524 |
Tagging PR #1532 |
v2.6.2 is now fully deployed |
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. |
Description/Screenshot
beforeUnload
event.ApplicationInsights-JS/AISKU/src/Initialization.ts
Line 487 in ef5323d
pagehide
event to set this flag to true and put it in every telemetry log using an interceptorbeforeUnload
, we cannot set this flag to true sincepagehide
event occurs afterbeforeUnload
event. And the difference in time between these two events is up to the user (the user could take a long time to click confirm/cancel the page navigation)It looks like app insight sdk is also adding the same event handler to the
pagehide
event, so I'm wondering if having the event handler for thebeforeUnload
event is necessarySteps to Reproduce
Expected behavior
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: