client-side solid-router prepends every relative link with hash, even when not desired
I am using hashIntegration with the solid-router for an SPA running on our site - but the entire site is not an SPA, and <Link>, <a>, <NavLink> (solid-bootstrap), etc., treat any links as hashed links for the router.
E.g., I do not want "/about/home" to go the client solid-router, I want it to go be handled by the .NET MVC router. Yet it doesn't seem to matter what tag I use, the links are automatically converted to "#/about/home", which traps the user inside the SPA.
Is there any way I can break out of this by setting something on the tag itself?
15 Replies
that's rather strange, <a href="/a/b"> shouldn't be captured by the router
probably getting dragged along with hash change
how are you serving your app? i think if that path really returns another page, it should work
I've worked around it for now by creating a new link component and using that where I want to avoid routing, but I'd still love to get to the bottom of why these relative paths are being hashed! The interesting thing is that my first attempt at injecting a domain to create an absolute path (i.e., http://localhost/a/b) had no effect at all and was still hashed!
probably that path is returning the same page, that's why it got appended with '#'
The SPA is being served on a .NET View. Basically no different from any other hosted page.
The base path is: http://arc-core.localhost/arc-forums.
could you confirm whether you're using latest solid-router?
I believe so. I did an NPM install today.
it used to catch all links, only way to disable that behavior is by adding
rel="external"
attributeAlthough may be I should have done a different kind of update...? I am new to NPM
the router also got moved to
@solidjs
namespace, now @solidjs/router
Yep, that's the one I'm using.
and it happens with
<a href="/path">
too?Yeah
Not just with Link
I thought it would just happen with Link
the ones you import from the package,
<NavLink/>
, <A/>
, etc already are setup to be captured by the router, but <a href="/path"
wouldn'tI'm progressively enhancing our NET Core MVC site which is why the SPA is being used in this way.
Hence my confusion. 😁
I have to sign off for now as it's late here but thanks for your input so far!
it probably depends on how the SPA is being served (i would start here),
<a href="/some-path">
would just hit the server, the browser continues to do what it does