Skip to content

Fix race condition issue of postcss-custom-properties #332

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

Merged
merged 2 commits into from
Apr 8, 2022
Merged

Fix race condition issue of postcss-custom-properties #332

merged 2 commits into from
Apr 8, 2022

Conversation

malash
Copy link
Contributor

@malash malash commented Apr 8, 2022

This PR fixed #331 . For more background please see that issue.

As I understand the prepare function is designed to store context variables for each CSS file, while the plugin function itself should contain some common code across CSS files, like some constant variables only related to opts.

In this case the customProperties is mutated and read between listeners. So it should be placed in prepare rather tha plugin function.

Ref: https://github.com/postcss/postcss/blob/main/docs/writing-a-plugin.md#step-3-find-nodes

@Antonio-Laguna
Copy link
Member

@malash could you merge main into this PR? We've hopefully enabled tests on PRs with the last commit, would love to see them here :)

…to fix-331

* 'main' of https://github.com/csstools/postcss-plugins:
  Reverting due to security concerns
  Switching target
  Enabling tests on pull_request
@malash
Copy link
Contributor Author

malash commented Apr 8, 2022

@Antonio-Laguna PR rebased and all CI passed.

Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

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

LGTM!

Thanks @malash !

@Antonio-Laguna Antonio-Laguna merged commit f0e9099 into csstools:main Apr 8, 2022
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.

A race condition issue in postcss-custom-properties
2 participants