Skip to content

Fix: Prevent crashing with multiple changes in succession to same file #52

Merged
kevinrenskers merged 2 commits into
loopwerk:mainfrom
deverman:dev-watch-serialization
Jun 26, 2026
Merged

Fix: Prevent crashing with multiple changes in succession to same file #52
kevinrenskers merged 2 commits into
loopwerk:mainfrom
deverman:dev-watch-serialization

Conversation

@deverman

Copy link
Copy Markdown
Contributor

I had a collision happen when I implemented an afterWrite hook that updates the file I'm editing with new tags and front matter generated from the content in the updated file.

There is a conflict with the current saga code leading to crashes because it spawned independent Tasks that were changing shared state.

I am submitting a patch that prevents this issue from happening by creating a coordinator that consolidates the paths and prevents multiple tasks trying to change shared state.

hope this can be integrated into saga proper. Let me know if you need any additional details.

@kevinrenskers

Copy link
Copy Markdown
Member

This looks very useful, thanks! Give me some time to look it over please, it might take until Monday.

@kevinrenskers kevinrenskers merged commit 658bdb5 into loopwerk:main Jun 26, 2026
2 checks passed
@kevinrenskers

Copy link
Copy Markdown
Member

I'm incredibly curious how (and why) you use an afterWrite hook to update the files you're editing. For me my markdown files are the source of truth, and I wouldn't really edit them from Saga, so my imagination fails me for how such a workflow could be useful. Sounds very cool though, I'd love to hear more!

@deverman deverman deleted the dev-watch-serialization branch June 27, 2026 08:45
@deverman

Copy link
Copy Markdown
Contributor Author

@kevinrenskers Thanks for merging. I have a module that is suggesting SEO metadata for unpublished articles based on the content as I write using Foundation modules.

@kevinrenskers

Copy link
Copy Markdown
Member

Oh, that's pretty cool. Neat idea!

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