Skip to content

Commit 0f64daf

Browse files
Merge pull request cerebral#491 from schiller-manuel/statechart-fast-refresh
fix(overmind-statechart): avoid throwing config error when fast refresh kicks in
2 parents 67056a0 + cee024f commit 0f64daf

File tree

1 file changed

+2
-2
lines changed
  • packages/node_modules/overmind-statechart/src

1 file changed

+2
-2
lines changed

packages/node_modules/overmind-statechart/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ export function statechart<
272272
const actions = config.actions || {}
273273
const state = config.state || {}
274274

275-
if (config.state && (config.state as any).states) {
275+
if (currentInstance !== undefined && config.state && (config.state as any).states) {
276276
throw new Error(
277277
`Overmind statecharts: You have already defined the state "states" in your configuration. Statecharts needs this, please rename it`
278278
)
279279
}
280280

281-
if (config.state && (config.state as any).matches) {
281+
if (currentInstance !== undefined && config.state && (config.state as any).matches) {
282282
throw new Error(
283283
`Overmind statecharts: You have already defined the state "matches" in your configuration. Statecharts needs this, please rename it`
284284
)

0 commit comments

Comments
 (0)