-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
docs: add shared state example for bind:group & add labels #14905
base: main
Are you sure you want to change the base?
Conversation
|
Hey, thanks for the PR. I don't think we can land this in its current form though.
|
Hi, thanks very much for direct reply! :) Just as personal note: I just checked the v4 docs https://v4.svelte.dev/docs/element-directives#bind-group - and my humble personal opinion is, that the Svelte v5 docs for this might need a general re-think? $state is directly introduced as technical concept in the v5 docs for For this PR: Should I try to move the shared state example to https://svelte.dev/docs/svelte/$state, remove the labels and link it in bind:group? |
This could be a good reference for what I had in mind, since shared state is the second example here: Currently the docs take developers to SvelteKits State Managament (gotchas) instead of Sveltes $state system. The state management guide for SvelteKit could also be improved, reference to Nuxt: I think the main problem I have with the current docs is that a lot of things are 'hidden' in the tutorials section. And my current assumption would be that developers check the docs first and do tutorials later (if not elsewhere). Especially when they're experienced with Svelte v4. But if this PR is not a good place for discussion, please feel free to close and I move it to discussions. Don't want to block your PR queue here. Thanks very much for providing this awesome community framework! 🧡 |
In the last couple of days I tried to learn the new Svelte v5 $state (notes). I did some small hobby projects with v4 before.
I mainly stumbled over the lack of examples for
bind:group
with shared state, since object wrapping is needed here when usingexport
. My current guess is that other developers will face the same challenge in future when they just check the docs forbind:group
for v5 and try to use it with shared state on their own (like I did). Took me multiple days and support on Discord/Bluesky to get it right.PR changes to bind-group docs:
bind:group
does not work with nested components #2308<label>
to the whole example to be a11y-complicantREPL for submitted code
As alternative, a link to a tutorial might help as well.
Keep up the awesome work with Svelte and much success in 2025! 🎉
PS: I know that there is also the section bind:property for components, but I just noticed it afterwards + it's very technical. Wouldn't have helped me. https://svelte.dev/tutorial/svelte/group-inputs also doesn't cover shared state.
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint
Couldn't run
pnpm lint
on node v23.5.0 and withpnpm 9.15.3
Error: Cannot find module '/Users/XXX/webserver/svelte/node_modules/.pnpm/[email protected]_svelte@packages+svelte/node_modules/svelte/compiler/index.js'