-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Uncaught SyntaxError: Unexpected token '&' #36
Comments
is it server rendering mode? could you reproduce this error, running the samples in https://github.com/skclusive/Skclusive.Blazor.Samples? if not could you share repo to reproduce the error? |
Yes, this is server rendering mode and I can't reproduce with Skclusive.Blazor.Samples at least not with Skclusive.Blazor.Dashboard. Here is the example project to reproduce the issue. Contains two commits:
|
thanks. i got it. we need to have the following options configured. not able to auto detect due to the way server rendering and server pre-rendering works. i guess this needs documentation updates as well. new MaterialConfigBuilder().WithIsServer(true)
.WithIsPreRendering(false)
.WithResponsive(true) let me know if this fixes the issue. |
I tried to change that line to:
Note
If |
i noticed the sample is using server prerendering and there is a caveat in server prerendering mode. so you need to add the below code in startup.cs. services.AddHttpContextAccessor();
services.AddScoped<IRenderContext>((sp) =>
{
var httpContextAccessor = sp.GetService<IHttpContextAccessor>();
bool? hasStarted = httpContextAccessor?.HttpContext?.Response.HasStarted;
var isPreRendering = !(hasStarted.HasValue && hasStarted.Value);
return new RenderContext(isServer: true, isPreRendering);
});
services.TryAddMaterialServices(new MaterialConfigBuilder().WithIsServer(true).WithIsPreRendering(true).Build()); i have verified it with your sample code. hope this helps. |
Work like a charm. Thank you :-) |
i guess documentation needs to be updated. keeping it open. |
Yep, please add it to the docs. I also tripped over this |
in the dashboard samples in the _Host file , the code for the "blazor-error-ui" div is commented out with the Todo comment |
@Sammy-AZ yes. that is separate issue. just need to update the site.css with default blazor styles for error-ui. will update. thanks. |
I'm seeing this exception in Console 2x. I identified it is caused by adding
<MaterialScripts />
to App.razor file. I guess something is wrong in theScriptHelpersScript.GetScript
JS string and also in theDomHelpersScript
.Is it something which can be safely ignored?
The text was updated successfully, but these errors were encountered: