-
Notifications
You must be signed in to change notification settings - Fork 82
feat(jotai): add 'HydrateAtoms' #1855
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 4039a19 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
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 |
People can be co-author:
|
|
@sukvvon is attempting to deploy a commit to the Toss Team on Vercel. A member of the Team first needs to authorize it. |
0c35b9a to
33e7c8b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1855 +/- ##
==========================================
+ Coverage 93.53% 93.56% +0.02%
==========================================
Files 45 46 +1
Lines 727 730 +3
Branches 185 184 -1
==========================================
+ Hits 680 683 +3
Misses 41 41
Partials 6 6
🚀 New features to boost your workflow:
|
33e7c8b to
780a694
Compare
05d23d1 to
e079379
Compare
e079379 to
03aae54
Compare
03aae54 to
a84694c
Compare
a84694c to
bb05f3e
Compare
Overview
Add
HydrateAtomscomponent to@suspensive/jotaipackage.This component is a wrapper around Jotai's
useHydrateAtomshook. It hydrates initial values into Jotai atoms, preventing state mismatch between server and client.Features
props.atomValues[[atom1, value1], [atom2, value2]]new Map([[atom1, value1], [atom2, value2]])[...generateAtomValues()]as constfor type inference[[writableAtom, arg1, arg2]]props.optionsstore: Specify a custom Jotai store to hydrate atoms intodangerouslyForceHydrate: Whentrue, forces re-hydration even if atoms have already been hydratedprops.childrenExample
Basic Usage
With Custom Store
With Suspense
Changes
HydrateAtomscomponent (packages/jotai/src/HydrateAtoms.tsx)packages/jotai/src/HydrateAtoms.spec.tsx) - 11 tests, 100% coveragepackages/jotai/src/HydrateAtoms.test-d.tsx)docs/suspensive.org/src/content/en/docs/jotai/HydrateAtoms.mdx)docs/suspensive.org/src/content/ko/docs/jotai/HydrateAtoms.mdx)packages/jotai/src/index.tsType Compatibility
Full type compatibility with jotai's
useHydrateAtoms:InferAtomTuplestype for validating atom-value tuple typesPR Checklist