Not Work With Blazor SSR (.NET8)
MAghazade opened this issue · 5 comments
hi
I'm using Blazor Identity UI (Individual Accounts) which uses SSR components,If we want to load the JS files in these pages, we have to do it this way ASP.NET Core Blazor JavaScript with static server-side rendering (static SSR),Based on the article above, I load the JS files in the pages and everything works fine, but after installing WebMarkupMin and using app.UseWebMarkupMin();
middleware ,js files like modules are no longer loaded(downloaded) when the page is loaded for the first time. But if there is a form
on the page, the files will be loaded correctly after the form
is submitted.
of course, if I put these pages in the list of ExcludedPages, the rest of the pages work correctly and the problem is only in SSR pages
logs :
[20:25:03 WRN] Unable to configure Browser Link script injection on the response. This may have been caused by the response's Content-Encoding: '["gzip"]'. Consider disabling response compression.
[20:25:03 WRN] Unable to configure browser refresh script injection on the response. This may have been caused by the response's Content-Encoding: '["gzip"]'. Consider disabling response compression.
Hello, Mohammad!
At the beginning of next week I will try to research this problem, because I don't have a developer's machine at hand right now.
Hello, Mohammad!
I would like to know in advance what the WebMarkupMin settings you use (AddWebMarkupMin
method and entire subsequent chain of methods).
[20:25:03 WRN] Unable to configure Browser Link script injection on the response. This may have been caused by the response's Content-Encoding: '["gzip"]'. Consider disabling response compression.
[20:25:03 WRN] Unable to configure browser refresh script injection on the response. This may have been caused by the response's Content-Encoding: '["gzip"]'. Consider disabling response compression.
These warnings are issued by the Browser Link when third party libraries are used for HTTP compression. This is not reason for the error. I recommend that you disable HTTP compression during debugging.
…, I load the JS files in the pages and everything works fine, but after installing WebMarkupMin and using
app.UseWebMarkupMin();
middleware ,js files like modules are no longer loaded(downloaded) when the page is loaded for the first time.
In this case, you should check for JS errors and warnings in the web browser console.
But if there is a form on the page, the files will be loaded correctly after the form is submitted.
of course, …
This is the expected behavior, therefore, by default, markup minification and HTTP compression are not performed for POST
method.
I created a repository
by commenting and uncommenting this line app.UseWebMarkupMin()
in the program.cs
file.you can see the behavior I explained :
without using app.UseWebMarkupMin()
js file should be downloaded and the loaded and updated message should appear on the console and vice versa
Hello, Mohammad!
Thanks for the example! This error fixed in version 2.16.1.
Unfortunately, there is still a problem with the Blazor streaming markers (<!--bl:…-->
, <!--/bl:…-->
and <!--bab39c12-73f9-4e04-b6b9-76cb2b324662-->
) that requires detailed research.
Thanks for the quick reply!
That fixed the issue - thanks!