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

Uncaught SyntaxError: Unexpected token AND 'blazorise' was undefined #2301

Closed
wartim opened this issue May 6, 2021 · 18 comments
Closed

Uncaught SyntaxError: Unexpected token AND 'blazorise' was undefined #2301

wartim opened this issue May 6, 2021 · 18 comments
Labels
Type: Bug 🐞 Something isn't working
Milestone

Comments

@wartim
Copy link

wartim commented May 6, 2021

1 My computer at home works normally, but there is an error in my company's computer: 'blazorise' was undefined
2 Then I found out that the sentence was wrong:
if (values && values.find(x => x?.toString() === opt.value)) {
opt.selected = true;
} else {
opt.selected = false;
}
3 Then I change it to this, and it will run normally. Is it the compatibility problem of the browser?
if (values && values.find(x => x === null ? null === opt.value : x.toString() === opt.value)) {
opt.selected = true;
} else {
opt.selected = false;
}

Error details:
Uncaught SyntaxError: Unexpected token .
blazor.server.js:1 [2021-05-06T06:29:09.681Z] Information: Normalizing '_blazor' to 'http://localhost:5000/_blazor'.
blazor.server.js:1 [2021-05-06T06:29:09.879Z] Information: WebSocket connected to ws://localhost:5000/_blazor?id=CRkyLOMBJ9v4v3RSnhw7bQ.
blazor.server.js:21 [2021-05-06T06:29:10.024Z] Error: Microsoft.JSInterop.JSException: Could not find 'blazorise.button.initialize' ('blazorise' was undefined).
Error: Could not find 'blazorise.button.initialize' ('blazorise' was undefined).
at http://localhost:5000/_framework/blazor.server.js:1:67390
at Array.forEach ()
at e.findFunction (http://localhost:5000/_framework/blazor.server.js:1:67350)
at v (http://localhost:5000/_framework/blazor.server.js:1:69092)
at http://localhost:5000/_framework/blazor.server.js:1:70038
at new Promise ()
at e.beginInvokeJSFromDotNet (http://localhost:5000/_framework/blazor.server.js:1:70011)
at http://localhost:5000/_framework/blazor.server.js:1:26293
at Array.forEach ()
at e.invokeClientMethod (http://localhost:5000/_framework/blazor.server.js:1:26263)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Blazorise.Button.b__9_0() in D:\s9net5\Blazorise-master\Source\Blazorise\Components\Button\Button.cs:line 65
at Blazorise.Base.BaseAfterRenderComponent.OnAfterRenderAsync(Boolean firstRender) in D:\s9net5\Blazorise-master\Source\Blazorise\Base\BaseAfterRenderComponent.cs:line 46
at Blazorise.BaseComponent.OnAfterRenderAsync(Boolean firstRender) in D:\s9net5\Blazorise-master\Source\Blazorise\Base\BaseComponent.cs:line 62
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
e.log @ blazor.server.js:21
I @ blazor.server.js:10
(anonymous) @ blazor.server.js:10
(anonymous) @ blazor.server.js:1
e.invokeClientMethod @ blazor.server.js:1
e.processIncomingData @ blazor.server.js:1
connection.onreceive @ blazor.server.js:1
i.onmessage @ blazor.server.js:1
blazor.server.js:1 [2021-05-06T06:29:10.033Z] Information: Connection disconnected.
5blazor.server.js:1 Uncaught (in promise) Error: Cannot send data if the connection is not in the 'Connected' State.
at e.send (blazor.server.js:1)
at e.sendMessage (blazor.server.js:1)
at e.sendWithProtocol (blazor.server.js:1)
at e.send (blazor.server.js:1)
at Object.endInvokeJSFromDotNet (blazor.server.js:10)
at blazor.server.js:1

@stsrki
Copy link
Collaborator

stsrki commented May 6, 2021

So it seems null optional chaining is not supported on one of your browsers. I will replace it with regular syntax and release it as a part of the next patch. Thanks for your help!

@stsrki stsrki added the Type: Bug 🐞 Something isn't working label May 6, 2021
@stsrki stsrki added this to the 0.9.3 milestone May 6, 2021
@David-Moreira
Copy link
Contributor

Ah this again... damn.
Just curious, may we know what browser was it @wartim?

@wartim
Copy link
Author

wartim commented May 7, 2021

@David-Moreira
chrome 76.0.3809.100

@stsrki
Copy link
Collaborator

stsrki commented May 7, 2021

It is an old chrome version. That explains a lot.

Mine is 90.0.4430.85

@stsrki
Copy link
Collaborator

stsrki commented May 7, 2021

PS. And all I wanted to do is to use some new JavaScript features 😭🤣

@wartim
Copy link
Author

wartim commented May 7, 2021

@stsrki
Yes, but it is not very old version, I think a CSS framework should have a certain degree of backward compatibility, not all customer computers have the latest version of the browser, especially in some factories in the deployment environment, for the sake of safety, it could only enterprise Intranet, is just a private cloud deployment or private sites, Probably will never update the browser and system version, I suggest you consider this, by the way, if you are compatible with IE7, 8, 9, 10, 11, Edge, that would be great, of course, that is demanding 😆

Also, I directly referenced your project source code to locate the problem. If I had used nuget "install..." If I can't see the source code, I have no idea what this error means. Syntax sugar is good, but also poison 😊

@stsrki
Copy link
Collaborator

stsrki commented May 7, 2021

I understand the problem, but being one guy doing almost all the work it's not easy. So taking care of backward compatibility with other work is the last option. Things could change soon... 😎😶

Regarding support for IE7, 8, 9, 10, is not an option since Blazor itself doesn't support them.

@stsrki
Copy link
Collaborator

stsrki commented May 9, 2021

@wartim What Blazorise version you use. It seems I have already fixed this issue but forgot about it. #2097

@stsrki
Copy link
Collaborator

stsrki commented May 9, 2021

The fix was released as part of the 0.9.3.3 patch.

@wartim what version do you use?

@wartim
Copy link
Author

wartim commented May 9, 2021

0.9.3.6

@stsrki
Copy link
Collaborator

stsrki commented May 9, 2021

Try hitting Ctrl+F5 to clear the browser cache.

@stsrki
Copy link
Collaborator

stsrki commented May 9, 2021

PS. I will definitely need to mention in the docs to add version on static files, eg

<script src="_content/Blazorise/blazorise.js?v=0.9.3.6"></script>
<script src="_content/Blazorise.Bootstrap/blazorise.bootstrap.js?v=0.9.3.6"></script>

@wartim
Copy link
Author

wartim commented May 9, 2021

The "master" version was downloaded on May 1st. It is 0.9.3.6 according to the instructions. I found that you updated it 2 hours ago. Maybe I should download it again.

@wartim
Copy link
Author

wartim commented May 9, 2021

PS. I will definitely need to mention in the docs to add version on static files, eg

<script src="_content/Blazorise/blazorise.js?v=0.9.3.6"></script>
<script src="_content/Blazorise.Bootstrap/blazorise.bootstrap.js?v=0.9.3.6"></script>

OK

@stsrki
Copy link
Collaborator

stsrki commented May 9, 2021

The master branch only contains the latest release for the live documentation. The actual patches are on the sup093 branch.

@wartim
Copy link
Author

wartim commented May 9, 2021

Okay, I have downloaded sup093.
To be honest, this makes me a little confused, can I understand it as: master (default) is a stable version, and only the code that has been verified stable will be merged into the master, and the latest modification of 0.9.3.X is placed In sup093. In addition, what is the difference between the development version of dev093?

@stsrki
Copy link
Collaborator

stsrki commented May 9, 2021

dev093 was the development branch up to the point when 0.9.3 was released. From there on all new patches go to sup093(release branch), and dev094 is for new work only.

The master branch is left in the state when dev093 was last merged, plus some changes in the documentation, mainly release notes for patches.

Once dev094 is finished the same cycle all over again.

@stsrki
Copy link
Collaborator

stsrki commented May 9, 2021

I plan to make slight changes in this workflow soon. Probably after v.1.0 is released. Being thinking lately that 0.9.4 might be the last beta version.

@stsrki stsrki closed this as completed May 18, 2021
@stsrki stsrki added this to Support Aug 3, 2024
@stsrki stsrki moved this to ✔ Done in Support Aug 3, 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
Archived in project
Development

No branches or pull requests

3 participants