Blazor 8 - Error: Microsoft.JSInterop.JSException: Could not find 'TelerikBlazor.initMediaQuery'

0 Answers 811 Views
General Discussions
George
Top achievements
Rank 1
Iron
Iron
George asked on 12 Apr 2024, 04:29 PM

Hello,

I have followed the Blazor 8 Getting started instructions but am getting the error Error: Microsoft.JSInterop.JSException: Could not find 'TelerikBlazor.initMediaQuery'.

I have double checked that the  <script src="_content/Telerik.UI.for.Blazor/js/telerik-blazor.js"></script> is in the <head> of the app.razor

i have double checked that the builder.Services.AddTelerikBlazor(); is in the program.cs

and I have the

<TelerikRootComponent>
    @Body
</TelerikRootComponent>

in the root layout component MainLayout.razor.

This error causes my stylesheets not to load. Occasionally the page will load with the stylesheets, but if a clear the cache or do a CTRL-SHIFT-R, I will get the error and my styles will unload.

HALP!

James
Top achievements
Rank 1
commented on 13 Jun 2024, 05:00 PM

I am starting to get this error intermittently on several existing Telerik Blazor Server apps. It happens on load, but doesn't happen every time. I haven't tracked down the issue yet.

Error: Microsoft.JSInterop.JSException: Could not find 'TelerikBlazor.initMediaQuery' ('TelerikBlazor' was undefined).
James
Top achievements
Rank 1
commented on 13 Jun 2024, 07:26 PM

My issue was probably due to network congestion and the telerik-blazor.js file not getting loaded in time to be referenced.
I think I have resolved my issue by delaying Blazor.Start() until the telerik-blazor.js file is loaded per the instructions here ->

https://docs.telerik.com/blazor-ui/troubleshooting/js-errors

https://docs.telerik.com/blazor-ui/getting-started/what-you-need#javascript-file

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
George
Top achievements
Rank 1
Iron
Iron
Share this question
or