You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The changes in #42 are working pretty well. The only thing I've noticed is that when I change the value of key, there is a brief moment where the app is still rendering the old value, before loading the value of the new key. This can cause unintended flashes of old content. Ideally, the render value should reset to onInit (or run onInit if it's a function) during that brief period, until the new key is hydrated.
The solution is pretty simple - we just need to reset the render value to onInit in the cleanup function here:
Another related (small) issue - there is a useful boolean flag in the onInit function to determine the hydration status. I think isHydrated would be a better name than isHydrating for what it's indicating. It is set to true when the value has been actually loaded from storage:
The changes in #42 are working pretty well. The only thing I've noticed is that when I change the value of
key
, there is a brief moment where the app is still rendering the old value, before loading the value of the new key. This can cause unintended flashes of old content. Ideally, the render value should reset toonInit
(or runonInit
if it's a function) during that brief period, until the new key is hydrated.The solution is pretty simple - we just need to reset the render value to
onInit
in the cleanup function here:storage/src/hook.ts
Lines 92 to 95 in 282b946
Another related (small) issue - there is a useful boolean flag in the
onInit
function to determine the hydration status. I thinkisHydrated
would be a better name thanisHydrating
for what it's indicating. It is set totrue
when the value has been actually loaded from storage:storage/src/hook.ts
Line 10 in 282b946
I can submit a PR when I have a chance :)
The text was updated successfully, but these errors were encountered: