-
Notifications
You must be signed in to change notification settings - Fork 240
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
disablePageUnloadEvents lost somewhere #2097
Comments
The way this config works is that it "trys" to obey your request, but if the runtime is unable to "add" any events (excluding the disabled ones) then it will turn around and add them anyway -- so that it's always got at least 1 event. ie. you can't "disable" all of them. Which version of the SDK? A quick look at the code appears that it should still be working, but I'm not finding any specific tests for this config value. I'm going to tag this issue so that at the very least we need to add unit tests around this. |
Is there a way to identify why other events were not able to be added? I'm using latest Chrome and adding Using
|
No, not without debugging into it, but based on this being Chrome 114, your running in a browser environment that should be handling this. Basically, it tracks whether the |
Or at least it should be @Karlie-777, @siyuniu-ms do you have some cycles to investigate this? |
@alfeg so the variable passed in |
Also can confirm issue - there is no config provider is missing And I guess I found issue in debug and were able to fix by patching node_modules files in https://github.com/microsoft/ApplicationInsights-JS/blob/b89849b7c2619a233a1c6fa58bf840e967de99b1/AISKU/src/AISku.ts#L332C1-L333C60 Naive fix is to read let analyticsPlugin = appInsightsInstance.appInsights;
- let theConfig = analyticsPlugin.config;
+ let theConfig = appInsightsInstance.config; But it seems to me that actual fix is a bit more trickier because |
Hmm, it "should" contain the But looking at the code this is returning the "extension" config only now and the As a "temporary" workaround you could try adding to both (as we need to fix this addHouseKeepingCode to use the code instance) so that temporarily at lease it should be present |
@MSNev Thanks for response But I'm not sure how to implement workaround. Guess I just need to wait for a new release |
Yeh, it will be null before the sdk is initialized (via the {
connectionString: "",
disablePageUnloadEvents : [ ... ],
extensionConfig: {
ApplicationInsightsAnalytics: {
disablePageUnloadEvents : [ ... ],
}
}
} |
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. |
ApplicationInsights-JS/AISKU/src/AISku.ts
Lines 332 to 344 in b89849b
Seems the disablePageUnloadEvents config is lost on the way somewhere so all unload event handlers are registered even if you try and disable them.
appInsights = new ApplicationInsights({ config: { disablePageUnloadEvents: ["unload", "beforeunload"], }, });
in AISku.ts line 332
let analyticsPlugin = appInsightsInstance.appInsights;
appInsightsInstance.config.disablePageUnloadEvents has the expected config value
but
appInsightsInstance.appInsights.config does not, and as thats the one that is assigned to theConfig the expected value is not used.
previously solved in #1683 #1684
The text was updated successfully, but these errors were encountered: