react18-tools / react18-tools/persist-and-sync
Add onRehydrate callback or isHydrated variable
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 48
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem? Please describe.
I have been using a bespoke solution to this problem with the vanilla persist middleware and love this higher order approach, however, there is no onRehydrate callback so I can't check if hydration has occurred and if not, block rendering or show a loading screen. In your sample app, it briefly shows 0 before updating to the correct value which is undesirable.
Describe the solution you'd like
I would like to be able to somehow check if the store has hydrated yet.
Describe alternatives you've considered
I have though about how to solve this and don't see any concise way to do so.
Additional context
N/A
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the persist middleware and the sample app referenced in the issue, then trace when persisted state is rehydrated. Define how a hydration callback or state flag should expose that lifecycle and prevent the sample from briefly showing 0; done means the behavior is covered and the loading state can be detected reliably.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100