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 cargo watch tooling #387

Merged
merged 3 commits into from
Aug 10, 2024
Merged

🔨 Fix cargo watch tooling #387

merged 3 commits into from
Aug 10, 2024

Conversation

JMicheli
Copy link
Collaborator

This pull request fixes an issue I was experiencing on my Windows development environment (though I do not believe it occurs on other environments).

The problem I had was that when running a dev server with yarn dev:web, cargo watch would constantly refresh the app. Running cargo watch --debug revealed that it was being caused by changes detected in the core/prisma directory, which seemed to coincide with database writes.

The rust-lang GitHub page has an issue discussing this problem and notes that cargo watch triggers on any changes to the directories it is watching (not just source files) unless that file is covered by the .gitignore. Although the .gitignore does cover *.db*, it seems that writes to the core/prisma directory generally were triggering recompiles.

What I ended up doing was putting the dev.db etc. files in core/prisma/dev instead, then added that to the .gitignore directly. It worked - no more random recompiles on Windows. Admittedly, this is a bit more cluttered than before, but I think it's worthwhile for me at least, and might help other devs in the future.

I also added indentation to a few doc comments because it made clippy mad.

@aaronleopold
Copy link
Collaborator

Have you tried passing an additional --ignore flag to cargo watch?

@JMicheli
Copy link
Collaborator Author

Have you tried passing an additional --ignore flag to cargo watch?

Oh. yeah you're right, that's an easier fix. I removed those other changes and fixed the problem by adding --ignore core/prisma.

@aaronleopold
Copy link
Collaborator

Nice! Happy it worked

@JMicheli JMicheli merged commit b7e5771 into develop Aug 10, 2024
6 checks passed
@JMicheli JMicheli deleted the cargo-watch-fix branch August 10, 2024 04:40
@aaronleopold aaronleopold mentioned this pull request Aug 15, 2024
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