-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Disable router for all links #6914
Comments
|
Thanks for your response. I know that my usage is very specific but the Can you give me more information about the decision of merging Let me know if I can do anything else. I'll be very happy to contribute ! |
I have the same issue as @MaximeMenotti (SvelteKit app loaded as part of a much larger monolith). Setting data-sveltekit-reload on every link (even outside of the SvelteKit app) is not an option, as I don't control parts of it. Let me know if you need a reproduction for this behaviour as well. In short: please provide a way to completely disable the SvelteKit router again. Thanks! |
I managed to work around the I would much prefer to be able to deactivate the SvelteKit router again tough. |
@MaximeMenotti took me a while to figure this out, but the reason <a href="/" data-sveltekit-reload>
Homepage
</a> ...results in the following markup in your Next app (note the <a href="/" data-sveltekit-reload="true">
Homepage
</a> In HTML, an attribute without an explicit value defaults to the empty string. React, shockingly, gets this wrong. You can work around it however by explicitly using the empty string: <a href="/" data-sveltekit-reload="">
Homepage
</a> You only need to do this on a top-level element. @mgrubinger it sounds like in your case what we really want is for the SvelteKit router to disregard history entries that it didn't create — does that sound right? That feels achievable |
@Rich-Harris thanks for looking into this! Yes, I think that would solve the issue in my scenario 👍 |
@Rich-Harris thanks a lot to look into this! You're right I am able to work with this: <a href="/" data-sveltekit-reload="">
Homepage
</a> But in a other hand I feel the way to use this workaround more painful for my consumers… Keeping the |
thank you! 💯 |
For anyone finding this via search engine (like myself), the option is documented is here: Routing and Link options: data-sveltekit-reload. And multiple links can be changed via Disabling options as far as I understand. |
Describe the problem
I use sveltekit in a micro-frontend like usage, injecting html and js generated by svelte-kit in another website.
I used
router=false
option to avoid sveltekit to interfere with the router of the receiving site but keep hydration to activate some js interaction.Since this PR was merged I should use this to keep same usage:
Unfortunately receiving site links like
<a href="/">Homepage</a>
are still caught by sveltekit router even if I setdata-sveltekit-reload
in<html>
tag of the receiving site.Describe the proposed solution
Bring back another configuration field
router
set to true by default.As
csr
andssr
fields add a way to configure this new field inpage.js
orlayout.js
Alternatives considered
No response
Importance
i cannot use SvelteKit without it
Additional Information
I don't have all the history of the changes of
router
field, I hope this issue was not already studied.It was a very convenient feature for me, I hope I can find a solution.
I can make the PR with proposed solution if needed.
The text was updated successfully, but these errors were encountered: