You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I thought that sveltejs/svelte#18406 would be
necessary to do this, but I was wrong — it actually seems easier and
simpler to bypass `hydratable` altogether. Instead, we serialize all the
remote data in one go, allowing devalue to do its thing and deduplicate
everything. (I still think it's worth merging that PR.)
That way, if you have (for example) a `getUser(): Promise<User | null>`
and a `requireUser(): Promise<User>` that calls `getUser` internally
(and redirects if it returns `null`), the `User` object is only
serialized once.
I can't remember exactly why we chose to use `hydratable` in the first
place. Perhaps it was a lifecycle thing — we wanted to be careful about
data being stale by the time it was read? In which case I think that has
changed now that query lifecycle is determined by the garbage collector.
Maybe @elliott-with-the-longest-name-on-github remembers.
---
### Please don't delete this checklist! Before submitting the PR, please
make sure you do the following:
- [ ] It's really useful if your PR references an issue where it is
discussed ahead of time. In many cases, features are absent for a
reason. For large changes, please create an RFC:
https://github.com/sveltejs/rfcs
- [x] This message body should clearly illustrate what problems it
solves.
- [x] Ideally, include a test that fails without this PR but passes with
it.
### Tests
- [ ] Run the tests with `pnpm test` and lint the project with `pnpm
lint` and `pnpm check`
### Changesets
- [x] If your PR makes a change that should be noted in one or more
packages' changelogs, generate a changeset by running `pnpm changeset`
and following the prompts. Changesets that add features should be
`minor` and those that fix bugs should be `patch`. Please prefix
changeset messages with `feat:`, `fix:`, or `chore:`.
### Edits
- [x] Please ensure that 'Allow edits from maintainers' is checked. PRs
without this option may be closed.
---------
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: Elliott Johnson <hello@ell.iott.dev>
0 commit comments