aohua / redux-state-sync

A lightweight middleware to sync your redux state across browser tabs
MIT License
235 stars 28 forks source link

Feature request: don't sync between different Firefox containers #155

Open NathanC opened 2 years ago

NathanC commented 2 years ago

Firefox has a system called multi-account containers that allow for logical separation between tabs (e.g. being logged into the same site with different accounts in different tabs). I often use this during development, to test interactions between different users.

I would only like redux state to be synced between tabs that are opened in the same container.

I think this could be implemented relatively easily using a non-http-only session-age marker cookie. Broadcast events would include the cookie, and tabs that have a different marker cookie (due to a different cookie jar because of being in an isolated container) would discard those events. There may be another way to implement it, but that's what came to mind.

Whst are your thoughts on this? I figure this is a low priority for you, so if you're OK with the feature I may take a stab at implementing it myself and opening a PR.

edit: looks like there might be a way to directly detect the container: https://discourse.mozilla.org/t/firefox-container-detection-using-cookiestoreid/95050/4