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

React: Force act running always in sequence #30191

Merged
merged 4 commits into from
Jan 7, 2025

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Jan 6, 2025

Closes N/A

What I did

act calls are now allowed to run in parallel. The made adjustment makes sure that act calls always run in sequence.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 77.8 MB 77.8 MB 590 B 0.47 0%
initSize 131 MB 131 MB 1.53 kB -1.36 0%
diffSize 53 MB 53 MB 943 B -1.36 0%
buildSize 7.19 MB 7.19 MB 194 B -0.21 0%
buildSbAddonsSize 1.85 MB 1.85 MB 0 B -0.31 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.87 MB 1.87 MB 12 B 0.69 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.91 MB 3.91 MB 12 B -0.3 0%
buildPreviewSize 3.28 MB 3.28 MB 182 B 12.61 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 23.6s 6.8s -16s -769ms -0.82 -243.7%
generateTime 21.9s 18.8s -3s -110ms -0.92 -16.5%
initTime 15.5s 12.5s -3s -34ms -0.87 -24.2%
buildTime 8.7s 9s 339ms -0.31 3.7%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.1s 4.6s -481ms -0.99 -10.3%
devManagerResponsive 3.7s 3.5s -191ms -0.86 -5.4%
devManagerHeaderVisible 605ms 547ms -58ms -1.41 🔰-10.6%
devManagerIndexVisible 635ms 560ms -75ms -1.64 🔰-13.4%
devStoryVisibleUncached 2s 1.9s -163ms -0.19 -8.5%
devStoryVisible 636ms 581ms -55ms -1.5 🔰-9.5%
devAutodocsVisible 491ms 535ms 44ms -0.58 8.2%
devMDXVisible 525ms 497ms -28ms -0.78 -5.6%
buildManagerHeaderVisible 519ms 555ms 36ms -0.77 6.5%
buildManagerIndexVisible 610ms 642ms 32ms -0.9 5%
buildStoryVisible 510ms 529ms 19ms -0.97 3.6%
buildAutodocsVisible 427ms 454ms 27ms -0.8 5.9%
buildMDXVisible 485ms 443ms -42ms -0.84 -9.5%

Greptile Summary

Based on the provided information, I'll create a concise summary of the key changes in this pull request:

Implemented sequential execution of React act calls in Storybook's test environment by introducing a queue-based system to prevent parallel execution.

  • Added actQueue array and isActing flag in code/renderers/react/src/act-compat.ts to manage task sequencing
  • Introduced withQueuedActEnvironment wrapper to ensure proper queue processing and environment state management
  • Maintains proper error handling and React environment state during async operations
  • Prevents potential race conditions when multiple act calls occur simultaneously

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

code/renderers/react/src/act-compat.ts Outdated Show resolved Hide resolved
code/renderers/react/src/act-compat.ts Outdated Show resolved Hide resolved
Copy link

nx-cloud bot commented Jan 6, 2025

View your CI Pipeline Execution ↗ for commit b066e56.

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 1m 8s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-07 11:10:38 UTC

@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-act-running-simultaneously branch from 0f5d551 to cc60f03 Compare January 6, 2025 13:30
@valentinpalkovic valentinpalkovic merged commit f6a6867 into next Jan 7, 2025
60 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/fix-act-running-simultaneously branch January 7, 2025 14:39
@github-actions github-actions bot mentioned this pull request Jan 7, 2025
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants