Skip to content

Catch interop undefined error instead of having application crash#61

Merged
isc30 merged 6 commits intoisc30:masterfrom
scott-parkhill:master
Mar 30, 2023
Merged

Catch interop undefined error instead of having application crash#61
isc30 merged 6 commits intoisc30:masterfrom
scott-parkhill:master

Conversation

@scott-parkhill
Copy link
Contributor

Closes #55

The changes this PR makes:

  1. In GoogleAnalyticsStrategy.cs, a new boolean is added called _interopError. This is set whenever a JSException is caught during an interop call. In our application, this has been failing from the GoogleAnalyticsInterop JS namespace being undefined, which we assume is related to Exception with AdBlock Plus #55. Out of an abundance of caution, the try-catch statements now wrap all interop calls. If an error is ever caught, it then disables that tracking until the application is refreshed.
  2. In GoogleAnalyticsStrategy.cs, ConfigureGlobalEventData was marked as async but awaited nothing, so this was changed to synchronous.
  3. In NavigationTracker.razor, there were calls to base.OnInitializedAsync() and base.OnAfterRenderAsync() which were unnecessary and removed.
  4. In NavigationTracker.razor, initialization was done through OnInitializedAsync() but no async work was being done, so this was changed to use OnInitialized() instead.
  5. In NavigationTracker.razor, there was an unsubscribe happening during initialization, and a Dispose method that wasn't being used because the component never declared that it implemented IDisposable. That unsubscribe was removed from the initialization method, and the component now implements IDisposable, so desubscription now occurs on component disposal.

@isc30 isc30 merged commit 19eb521 into isc30:master Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception with AdBlock Plus

2 participants