Skip to content
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]: JSBreakpointModule throwing exceptions #5482

Open
njannink opened this issue Apr 29, 2024 · 4 comments
Open

[Bug]: JSBreakpointModule throwing exceptions #5482

njannink opened this issue Apr 29, 2024 · 4 comments
Assignees
Labels
Type: Bug 🐞 Something isn't working
Projects
Milestone

Comments

@njannink
Copy link
Contributor

njannink commented Apr 29, 2024

Blazorise Version

1.5.1

What Blazorise provider are you running on?

Material

Link to minimal reproduction or a simple code snippet

I see following JSException in our logs with multiple stacktraces. Don't know the rootcause yet, but all trace back to the JSBreakpointModule

System.AggregateException: Exceptions were encountered while disposing components. (Importing a module script failed.
undefined) (Importing a module script failed.
undefined)
 ---> Microsoft.JSInterop.JSException: Importing a module script failed.
undefined
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
   at Blazorise.Modules.BaseJSModule.<GetModule>g__InitializeModule|10_0()
   at Blazorise.Modules.BaseJSModule.InvokeSafeVoidAsync(String identifier, Object[] args)
   at Blazorise.Modules.JSBreakpointModule.UnregisterBreakpoint(IBreakpointActivator component)
   at Blazorise.Bar.DisposeAsync(Boolean disposing)
   at Blazorise.BaseAfterRenderComponent.DisposeAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.<>c__DisplayClass85_0.<<Dispose>g__HandleAsyncExceptions|1>d.MoveNext()
   --- End of inner exception stack trace ---
 ---> (Inner Exception #1) Microsoft.JSInterop.JSException: Importing a module script failed.
undefined
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
   at Blazorise.Modules.BaseJSModule.<GetModule>g__InitializeModule|10_0()
   at Blazorise.Modules.BaseJSModule.InvokeSafeVoidAsync(String identifier, Object[] args)
   at Blazorise.Modules.JSDropdownModule.Destroy(ElementReference elementRef, String elementId)
   at Blazorise.Dropdown.DisposeAsync(Boolean disposing)

Microsoft.JSInterop.JSException: Importing a module script failed.
undefined
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
   at Blazorise.Modules.BaseJSModule.<GetModule>g__InitializeModule|10_0()
   at Blazorise.Modules.BaseJSModule.InvokeSafeVoidAsync(String identifier, Object[] args)
   ...
   at Blazorise.BaseAfterRenderComponent.OnAfterRenderAsync(Boolean firstRender)
   at Blazorise.BaseComponent.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
@njannink njannink added the Type: Bug 🐞 Something isn't working label Apr 29, 2024
@njannink
Copy link
Contributor Author

What I can image that there are certain scenarios where this getBreakpoint fails causing the script loading to fail.

lastBreakpoint = getBreakpoint();

// Get the current breakpoint
export function getBreakpoint() {
    return window.getComputedStyle(document.body, ':before').content.replace(/\"/g, '');
}

@njannink
Copy link
Contributor Author

Possible will need to check if the DOM is ready before trying to access it:

https://stackoverflow.com/questions/8100576/how-to-check-if-dom-is-ready-without-a-framework

@stsrki
Copy link
Collaborator

stsrki commented Apr 30, 2024

I'm leaving this here in case we need it https://kristoffer-strube.dk/post/cancelling-long-running-jsinterop-calls/

@njannink
Copy link
Contributor Author

I actually see this error a lot now in our server logs making it a bit more urgent.

@stsrki stsrki added this to 🔙 Backlog in Support via automation May 1, 2024
@stsrki stsrki added this to the 1.5 support milestone May 1, 2024
@stsrki stsrki moved this from 🔙 Backlog to ⏳ In Review in Support May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐞 Something isn't working
Projects
Support
  
⏳ In Review
Development

No branches or pull requests

2 participants