effector
effector copied to clipboard
Rework `domain`-related APIs
Proposal
Current domain-related APIs is a hard to parse by AST-awared plugins. It leads to some problems and races with other tools (e.g., https://github.com/effector/effector/issues/580, https://github.com/effector/effector/issues/482, https://github.com/effector/effector/issues/204). But, effector-react uses the different approach and doesn't have this issue.
const domain = createDomain()
const Gate = createGate({ domain })
I propose to add the new optional parameter to all creator-functions.
// old approach
const domain = createDomain()
const $domainStore = domain.createStore(null)
// new approach
const domain = createDomain()
const $domainStore = createStore(null, { domain });
In next major releases, we can deprecate domain.create*-calls.
What do you think, folks?
Great idea! 👍 It should really improve developer experience