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(postcss): race condition on builder instance for simultaneous plugin invocations #2919

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

doubleaxe
Copy link

Closes #2916

📝 Description

Fixes postcss race condition because builder instance is singelton, and postcss plugin is async.

⛳️ Current behavior (updates)

Reported in bug report.

🚀 New behavior

Added builderGuard which allow only one plugin invocation to be run at a time, other invocations will wait. Tested on my instance.

💣 Is this a breaking change (Yes/No): No

📝 Additional Information

Copy link

changeset-bot bot commented Oct 13, 2024

🦋 Changeset detected

Latest commit: 8da1e6d

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

This PR includes changesets to release 19 packages
Name Type
@pandacss/postcss Patch
@pandacss/dev Patch
@pandacss/astro-plugin-studio Patch
@pandacss/config Patch
@pandacss/core Patch
@pandacss/extractor Patch
@pandacss/generator Patch
@pandacss/is-valid-prop Patch
@pandacss/logger Patch
@pandacss/node Patch
@pandacss/parser Patch
@pandacss/preset-atlaskit Patch
@pandacss/preset-base Patch
@pandacss/preset-open-props Patch
@pandacss/preset-panda Patch
@pandacss/shared Patch
@pandacss/studio Patch
@pandacss/token-dictionary Patch
@pandacss/types 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

Copy link

vercel bot commented Oct 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
panda-docs ✅ Ready (Inspect) Visit Preview Oct 13, 2024 9:55am
panda-playground ✅ Ready (Inspect) Visit Preview Oct 13, 2024 9:55am
panda-studio ✅ Ready (Inspect) Visit Preview Oct 13, 2024 9:55am

Comment on lines +68 to +78
for (;;) {
if (!builderGuard) break
await builderGuard
}
const _builderGuard = postcssProcess(...args)
if (!_builderGuard) return

builderGuard = _builderGuard.finally(() => {
builderGuard = undefined
})
return builderGuard
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is happening here ? I'm not familiar with this for (;;) trick

also, would it be possible to add a test somewhere in there https://github.com/chakra-ui/panda/blob/main/packages/postcss/__tests__/postcss.test.ts

@xcarpentier
Copy link

Hi @doubleaxe,

Do you think that PR will fix other issue "I don't see any styles" or it's not related at all ?

https://panda-css.com/docs/installation/nextjs#i-dont-see-any-styles

Thanks

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.

3 participants