Skip to content

Commit

Permalink
[HxTagGoogleManager] Race condition fix (initialization not completed…
Browse files Browse the repository at this point in the history
… before another push called)
  • Loading branch information
hakenr committed Nov 13, 2024
1 parent 2c245e8 commit b0f6d8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Havit.Blazor.GoogleTagManager/HxGoogleTagManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public HxGoogleTagManager(
/// <inheritdoc/>
public async Task InitializeAsync()
{
_jsModule ??= await _jsRuntime.InvokeAsync<IJSObjectReference>("import", "./_content/Havit.Blazor.GoogleTagManager/" + nameof(HxGoogleTagManager) + ".js");

if (_isInitialized)
{
return;
}
_isInitialized = true;

_jsModule ??= await _jsRuntime.InvokeAsync<IJSObjectReference>("import", "./_content/Havit.Blazor.GoogleTagManager/" + nameof(HxGoogleTagManager) + ".js");

await _jsModule.InvokeVoidAsync("initialize", _gtmOptions.GtmId);
}

Expand Down

0 comments on commit b0f6d8d

Please sign in to comment.