[BUG] overmind-statechart throws error when react fash refresh kicks in
schiller-manuel opened this issue · 1 comments
schiller-manuel commented
React's fast refresh reruns statechart when a module that contains this call is edited.
As the statechart is already initialized, a config error is thrown since states and matches are already present in the current state.
These are the affected lines:
if (config.state && (config.state as any).states) {
throw new Error(
`Overmind statecharts: You have already defined the state "states" in your configuration. Statecharts needs this, please rename it`
)
}
if (config.state && (config.state as any).matches) {
throw new Error(
`Overmind statecharts: You have already defined the state "matches" in your configuration. Statecharts needs this, please rename it`
)
}
christianalfoni commented
Released! 🎉