Catch interop undefined error instead of having application crash#61
Merged
isc30 merged 6 commits intoisc30:masterfrom Mar 30, 2023
Merged
Catch interop undefined error instead of having application crash#61isc30 merged 6 commits intoisc30:masterfrom
isc30 merged 6 commits intoisc30:masterfrom
Conversation
Instead, it now catches the exception and stops tracking the connection.
isc30
approved these changes
Mar 30, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #55
The changes this PR makes:
GoogleAnalyticsStrategy.cs, a new boolean is added called_interopError. This is set whenever aJSExceptionis caught during an interop call. In our application, this has been failing from theGoogleAnalyticsInteropJS 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.GoogleAnalyticsStrategy.cs,ConfigureGlobalEventDatawas marked asasyncbut awaited nothing, so this was changed to synchronous.NavigationTracker.razor, there were calls tobase.OnInitializedAsync()andbase.OnAfterRenderAsync()which were unnecessary and removed.NavigationTracker.razor, initialization was done throughOnInitializedAsync()but no async work was being done, so this was changed to useOnInitialized()instead.NavigationTracker.razor, there was an unsubscribe happening during initialization, and aDisposemethod that wasn't being used because the component never declared that it implementedIDisposable. That unsubscribe was removed from the initialization method, and the component now implementsIDisposable, so desubscription now occurs on component disposal.