atlassian / react-sweet-state

Shared state management solution for React

Home Page:https://atlassian.github.io/react-sweet-state/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accept symbols for scope

anacierdem opened this issue · comments

Currently a container accepts a scope prop and its store instance is shared with other containers having the same scope. This may rarely cause collisions in complicated scenarios. Considering one would generally want to have "unique" scopes for different sections of a react application, I think we should accept symbols to make scope management a little bit more robust when we want to.
This is not something of high priority though. Would be a nice addition.

This is an interesting suggestion. The issue is how can we combine it with store key, as I'm using that string for a bunch of lookups and debug.
Would have to change the registry shape to be nested by scope 🤔
Will leave the issue open, to see if there is more interest and might give it a go sometime to see the implications

Given the actual key is a combination of scope, store name and shape, we currently have yet to register a collision. Closing this for now, might re-evaluate if someone reports a bug.