Skip to content

Commit

Permalink
Bring back the warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Jan 27, 2023
1 parent c6ef237 commit b0bb50d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/core/src/Machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import {
TypegenDisabled,
ResolveTypegenMeta
} from './typegenTypes';
import { IS_PRODUCTION } from './environment';

let warned = false;

/**
* @deprecated Use `createMachine(...)` instead.
Expand Down Expand Up @@ -139,5 +142,12 @@ export function createMachine<
TServiceMap,
TTypesMeta
> {
if (!IS_PRODUCTION && !('predictableActionArguments' in config) && !warned) {
warned = true;
console.warn(
'It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html'
);
}

return new StateNode(config, options as any) as any;
}

0 comments on commit b0bb50d

Please sign in to comment.