-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[breaking] move hydrate
and router
options to handle
#3397
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
Conversation
🦋 Changeset detectedLatest commit: 492f169 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✔️ Deploy Preview for kit-demo canceled. 🔨 Explore the source changes: 492f169 🔍 Inspect the deploy log: https://app.netlify.com/sites/kit-demo/deploys/61e7101640ad480008402c7a |
Do we still have the ability to disable all JS on the page? Would that be done just by setting |
You would do it with the resolve options now instead of the page options |
hydrate
and router
options to handle
This reverts commit b0c38f2.
The demo app will need to be updated too:
|
The reason we removed Here, the trade-off is a bit different — we're sacrificing ergonomics to save a very small number of bytes. If we added the function form, we'd be adding the bytes right back. To me it really doesn't seem worth it.
I have — this covid tracker embed on the front page of https://www.nytimes.com is rendered with SvelteKit — it's part of the same app that powers the tracker itself. Without disabling the router, clicking on a link will cause bad things to happen, since we're on a page that Kit doesn't 'own': It's not practical to put If we were really motivated to remove those bytes, one option could be to add |
I don't feel very strongly about this, so won't object to closing it. Alternatively, maybe we can just remove the page-level
It's not just the bytes for the flag, but also for the ability to enable and disable the router, which I'm not sure is strictly necessary and adds a bit more complication
I'm assuming it would disable the router app-wide though in that case and not just on the one page? Because you could still do that here |
That would only work if
I could probably be persuaded that disabling the router when you navigate to a
The router is enabled on the app as a whole, but the embeds have |
It doesn't really make sense to put these options in the
.svelte
files because then they get shipped to the client where they're not needed (especially in the case ofhydrate
), so they make more sense asresolve
optionsOn the client-side, you can implement
router: false
on a specific link usingrel="external"
. I'm not sure I've ever seen a use case for doing it to all links on a page besides just saving the weight of the JS router, which you can still do with the resolve option. It's possible we could add a method alongsidecancel
if there were such a use caseFor now this makes
hydrate
androuter
booleans, but we could easily allow people to continue specifying these options in the page if we made themfunction
s which took the page as a parameter. I think this could be a good idea becauseprerender
really doesn't need to be shipped to the client either, since it only matters during build-time. I'd like to make it aresolve
option as well, but fear that may be more disruptive if backwards compatibility is not kept. Sadly it's not tree shaken as unused todayThe one possible alternative to this PR for getting stuff out of the client would be to implement something like
<script context="module:ssr">
as suggested in sveltejs/rfcs#27hydrate
remains as an app-level option because it is passed to the compiler