polemius / recoil-persist

Package for recoil state manager to persist and rehydrate store
https://polemius.dev/recoil-persist/
MIT License
353 stars 39 forks source link

Feat/synchronize windows #72

Open OwenDelahoy opened 1 year ago

OwenDelahoy commented 1 year ago

This PR uses the storage event so that when the localStorage is modified outside of the application it is synchronized back to recoil.

This allows for synchronization of state between multiple tabs/windows/iframe, and updates the application's recoil state when a developer edits the localState within "Application" tab of chrome DevTools.

With the addStorageListener property of PersistConfiguration, the functionality can be adapted to storage configurations other than the localStorage, or if this is undesired, it can be disabled.

OwenDelahoy commented 11 months ago

@polemius I've updated this PR to resolve conflicts