Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Add warning for imperative built-in action calls #4876

Merged
merged 7 commits into from
May 4, 2024

Conversation

davidkpiano
Copy link
Member

This PR warns for improper imperative calls of built-in actions, which is a very common problem.

https://stately.ai/docs/actions#built-in-actions

Copy link

changeset-bot bot commented Apr 29, 2024

🦋 Changeset detected

Latest commit: 4be3f35

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
xstate Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -4,6 +4,7 @@ const { constants } = require('jest-config');
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
prettierPath: null,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mitigates this error:

Jest: Inline Snapshots are not supported when using Prettier 3.0.0 or above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supposedly it is fixed in Jest@30 (alpha) but 29 is still the latest version 😢

Copy link

@fekete965 fekete965 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 (although I am not familiar with the entire code base like you 🙈 )

@davidkpiano
Copy link
Member Author

Ping @Andarist

davidkpiano and others added 2 commits May 4, 2024 16:11
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
@@ -1550,6 +1554,7 @@ function resolveAndExecuteActionsWithContext(
: undefined;

function executeAction() {
executingCustomAction = resolvedAction;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd move this into the try block, it will be more clear that it goes together with the reset in the finally block

@davidkpiano davidkpiano merged commit 3f6a73b into main May 4, 2024
1 check passed
@davidkpiano davidkpiano deleted the davidkpiano/warn-for-imperative-built-in-actions branch May 4, 2024 23:15
@github-actions github-actions bot mentioned this pull request May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants