-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Feat/hydrated #6555
Feat/hydrated #6555
Conversation
🦋 Changeset detectedLatest commit: 9646f04 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 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Thank you. I'm not sure we really need this though — it's very easy to do in userland: // src/lib/hydrated.js
export let hydrated = false
export function update() {
hydrated = true;
} <!-- src/routes/+layout.svelte -->
<script>
import { onMount } from 'svelte';
import { update } from '$lib/hydrated.js';
onMount(update);
</script> Thereafter, any |
FeedbackThat's very straightforward for userland, I like it. As a lib author, that means that we can't rely on a
<!-- src/routes/+layout.svelte -->
<script>
import { onMount } from 'svelte';
import { init } from 'MyLib';
onMount(init);
</script> These manual user steps are not ideal. Our solutionThx to @AlecAivazis vite plugin, we will be able to inject this bit of code without any manual action. Side comments
|
@jycouet Could you show the code for this vite plugin that does exactly what Rich's code does with I need an example of such simple code to do something different, but which should initialize in the same way. |
This exact code is not done yet. Will you need this for a library? |
I need this under a script that I only use during dev (replaces I am always in favor of universal automation where possible. |
Issue link: #4447
Adding:
To be able in a
load
function to know if the app was already hydrated or not.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0