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

chore(project-sync): Fix infinite looping due to package.json changes #11341

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

Josh-Walker-GM
Copy link
Collaborator

Recently more of our build commands have adopted temporarily modifying the package.json file in order to generate the correct types. This has resulted in yarn rwfw project:sync going into an infinite loop as it detects changes as result of a build and triggers another build in response.

Chokidar is debouncing events so we only receive them once the watcher function has completed. Here I simply add a small 8s period of time after a build completes where any events it registers for package.json files (which should include those gathered during the build itself) are ignored.

The false negative case here is that someone changes a package.json soon after a build completes or during when a build is running. In that case it won't be picked up. People will likely see that no sync happened and just hit save again triggering a build since the 8s will have elapsed.

@Josh-Walker-GM Josh-Walker-GM added release:chore This PR is a chore (means nothing for users) changesets-ok Override the changesets check labels Aug 22, 2024
@Josh-Walker-GM Josh-Walker-GM added this to the chore milestone Aug 22, 2024
@Josh-Walker-GM Josh-Walker-GM self-assigned this Aug 22, 2024
@Tobbe
Copy link
Member

Tobbe commented Aug 22, 2024

People will likely see that no sync happened and just hit save again triggering a build since the 8s will have elapsed.

They also have to make some nonsense change, to actually have something to save, right?

Either way - this is good enough for now. We can come back to this if people have serious issues with it

@Josh-Walker-GM Josh-Walker-GM merged commit dc8e847 into main Aug 22, 2024
47 of 48 checks passed
@Josh-Walker-GM Josh-Walker-GM deleted the jgmw/chore-tarsync-prevent-infinite-looping branch August 22, 2024 14:52
@Josh-Walker-GM Josh-Walker-GM modified the milestones: chore, v8.0.0 Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changesets-ok Override the changesets check release:chore This PR is a chore (means nothing for users)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants