persist-and-sync icon indicating copy to clipboard operation
persist-and-sync copied to clipboard

Add onRehydrate callback or isHydrated variable

Open ClayMav opened this issue 7 months ago • 1 comments

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

ClayMav avatar Jun 29 '25 05:06 ClayMav

@ClayMav Hi. What if you set a default value that explicitly indicates that the data has not been loaded yet? For example null or undefined.

gormonn avatar Jul 29 '25 22:07 gormonn