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

fix(react-rsbuild): avoid race condition in async #3

Merged
merged 1 commit into from
May 17, 2024
Merged

Conversation

fi3ework
Copy link
Member

While in the previous code, const tsconfigPath = await findUp('tsconfig.json', { cwd: process.cwd() }) introduced aysnc logic so the tsconfigPathsInitialized will not take effect when multiple reactDocgenLoader invoked at the same time and will result in repeated initialization for many times.

img_v3_02av_b1ad22cf-4353-4a0f-bd67-5fdefe06c8bg

this PR fixed that to work with the async logic.


Conceptually, this should also raise with @storybook/builder-webpack5 but I can't reproduce it with a demo. The async logic will always be finished before other invoking. I will launch another a PR to @storybookjs/storybook since the code here is copied from the repository (https://github.com/storybookjs/storybook/blob/next/code/presets/react-webpack/src/loaders/react-docgen-loader.ts).

cc @chenjiahan

@chenjiahan
Copy link
Member

Nice!

@chenjiahan chenjiahan merged commit f188a57 into main May 17, 2024
1 check passed
@chenjiahan chenjiahan deleted the race branch May 17, 2024 13:27
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.

2 participants