-
-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
breaking: Refactor global stores for Modal
, Toast
, and Drawer
#1831
breaking: Refactor global stores for Modal
, Toast
, and Drawer
#1831
Conversation
🦋 Changeset detectedLatest commit: 2eea63b 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Seems good at at glance @AdrianGonz97. I'll test it out this week and we'll aim to get this in for the v2 release. Thank you for updating the docs already as well! |
@AdrianGonz97 I always like to add context for WHY you're implementing something in the instruction, so I've modified this bit in the featured example for drawers, modals, and toasts: I think with this I'm good with moving forward and merging this. |
Linked Issue
Closes #522
Description
This PR aims to fix the SSR related issues that comes with stores that are defined in the global scope. To fix this, we'll be using Svelte's context API as a means of attaching these stores to the component tree for safe keeping.
Store Initialization
The first change is how these utility stores are initialized. As we are using contexts now, we need to initialize and set the contexts for these stores in the root layout file.
We provide a utility function,
initializeStores()
, that will handle the initialization for the users:Retrieving Stores
Stores for
Modal
,Toast
, andDrawer
are now accessed through a function that will retrieve their respective stores....and that's it! It's a pretty minor, yet effective change that clears up all of the nasty SSR issues that these particular stores have been troubling us with.
As a bonus, these stores can now be safely used at the top level of components without any fear of the server's store persisting its state:
Changsets
Instructions: Changesets automate our changelog. If you modify files in
/packages/skeleton
, runpnpm changeset
in the root of the monorepo, follow the prompts, then commit the markdown file. Changes that add features should beminor
while chores and bugfixes should bepatch
. Please prefix the changeset message withfeat:
,bugfix:
orchore:
.Checklist
Please read and apply all contribution requirements.
dev
branch (NEVERmaster
)docs/
,feat/
,chore/
,bugfix/
pnpm check
pnpm format
pnpm test