Patch Changes
-
#584
bc52fc4Thanks @JeongHwan-dev! -useStorageStatenow returns the currentdefaultValuewhen the key is not stored anddefaultValueorkeychanges between renders. The snapshot cache only compared the raw stored string, so two absent keys both read asnulland the default parsed on the first render was returned forever.defaultValueis compared by structure, so an inline object or array default keeps the same reference across renders. -
#585
7327f02Thanks @JeongHwan-dev! -useStorageStatenow subscribes to storage changes once per key instead of on every render. The subscribe function handed touseSyncExternalStorewas recreated each render, so React tore down and re-registered the internal listener and thewindowstoragelistener on every commit. -
#583
245f57cThanks @JeongHwan-dev! -useVisibilityEventnow keeps onevisibilitychangelistener for the life of the component. The listener was keyed on thecallbackreference, so an inline callback removed and re-added it on every render, and withimmediate: truea callback that updated state re-ran on every render, which could loop forever. The callback is now preserved and always sees the latest closure.