-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
JSInterop Exception using Tooltip in v0.9.5 #3122
Comments
Can you tell us how did you set up your app to be behind a subdirectory? |
For sure, the main idea is to use Specifically, in my app.MapWhen(context => context.Request.Path.StartsWithSegments("/admin"), admin =>
{
admin.UsePathBase("/admin");
admin.UseStaticFiles();
admin.UseRouting();
admin.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/Admin/_Host");
});
});
app.MapWhen(context => !context.Request.Path.StartsWithSegments("/admin"), api =>
{
api.UseRouting();
api.UseAuthentication();
api.UseAuthorization();
api.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller}/{action=Index}/{id?}"
);
});
}); Then my Blazor pages ( My guess is that perhaps something in v0.9.5 is not respecting the call to |
A small public repo to reproduce the issue would be great. In the meantime, we will try with the code sample that you posted. |
I have applied the route changes and it seems to be working without any issues on my side. Is there any chance you're behind a firewall? |
I do have both a hardware and a software firewall between me and the internet at large, but I'm running everything locally and encountering this error on localhost within Visual Studio. My application has been working correctly for months under earlier versions, and the only thing required to break/fix it is to upgrade/downgrade the single Blazorise nuget package. Here is a project that's reproducing the issue (on my computer, at least!): https://github.com/mikeu/blazorise-3122-repro. Hopefully it either also reproduces it for you, or gives a clue as to what I need to change to keep working with the latest version of Blazorise. Assuming that you see the error when you visit the subdirectory page, you should then also be able to downgrade Blazorise and see the tooltip appear without error. Please let me know if there's anything else I can do to help resolve this. |
Hello, We've moved to using Javascript modules, which means we do all the heavy lifting behind the scenes, and you may remove the calls to blazorise.js and other resources (see docs, migration point 7) We've assumed the default convention / location to map your static files. Meaning we'll try to grab them out of /_content/Blazorise/tooltip.js @stsrki I guess we can take a look at enabling blazorise configuration so that a relative path to the static assets can be given? @mikeu in the meantime, you can just make sure to map the static files at the root, by calling |
@stsrki actually I was taking a further look at this as I was considering already submitting a PR with a new Just that we have some hardcoded paths on our js for code reuse. |
Hi @David-Moreira , thanks for that link. I did look for migration details yesterday, but between the docs page's not working properly and not having the release notes on the main project readme, I didn't find that info. I'm not sure it's related to the problem, as the behaviour seems to be basically the same with or without those files referenced in As for calling One interesting point is that the network tab shows first a request for |
Hah, looks as if we noticed that path in Blazorise.Bootstrap at just about the same time! Thanks for looking into this as well :) |
@David-Moreira I don't think adding a static path to the configuration would be needed. Based on the .NET and Blazor documentation the path should be solved by the framework. We did all "by the book", and every path starts with I think |
Can you take a look at my comment :
That to me isn't by the book as it does not take into account the relative path like in the other places, it's hard coded to the root instead. So we have two different behaviours. Edit: my initial suggestion was because I tought we had a hardcosed path, but I noticed we actually resolve a relative path on the c# side. On js it's hard coded to root. |
@David-Moreira You might be right. When I was first implementing JS Modules and trying to do the import of the root import { initialize as baseInitialize, destroy, updateContent } from "/_content/Blazorise/tooltip.js"; it didn't work when I added Now, I'm trying to come up with a better way and it seems that the following works just fine. import { initialize as baseInitialize, destroy, updateContent } from "../Blazorise/tooltip.js"; Which makes sense. Blazorise DLL would always be loaded first and we just need to go up one directory to get to its static files. Based on my testing now, it works in all scenarios, With or without a virtual subdirectory path. I will submit a PR and you can test on your side. |
I'm getting the same or similar problem using version 0.9.5.
Notice that it's missing the directory before _content. I only noticed it when I deployed to a server. But it works locally. I think it's because locally it's using localhost so there is no subdirectory. So was this presumably fixed? |
@stevenlupo Yes, it is fixed but we didn't release an update yet. We need to finish some other issues before. |
Describe the bug
When using the Tooltip component on v0.9.5, an error is thrown in the console and the Blazor Server application crashes:
I have tried in current versions of both Firefox and Chrome, with both Blazorise.Bootstrap and Blazorise.Material. All combinations work under v0.9.4.8 (and earlier), and throw an error under v0.9.5.
To Reproduce
Steps to reproduce the behaviour:
<Tooltip>
component working correctly under v0.9.4.8 (possibly not in the root path, see below).Expected behaviour
The tooltip should display in the browser without throwing any error or severing the websocket connection to Blazor Server.
Additional context
I don't know whether this is relevant, but my Blazor Server application resides in a subdirectory. There is an ASP.NET API served on
https://localhost:5001
and handled by controllers, while Blazor is running onhttps://localhost:5001/admin
.This setup has been working perfectly with previous versions of Blazorise, but I mention it because the invalid MIME type error displayed immediately before the exception does not include that custom path. That is, it fails to load
https://localhost:5001/_content/Blazorise/tooltip.js
, which makes sense, because the file is athttps://localhost:5001/admin/_content/Blazorise/tooltip.js
. Although I'm not sure why the error is that the module has an invalid MIME type, instead of that it doesn't exist...The text was updated successfully, but these errors were encountered: