Closed gs-jdudulski closed 1 month ago
Hey @gs-jdudulski,
This error happens to anything you do? Or only when you remove/delete something from your catalog?
Anything, on regular edits in files
Did you try removing the .eventcatalog-core
?
Just did, still the same.
But googling deeper I figured out it's becuase of... neovim. When editing in anything else it's fine.
Edit: https://github.com/neovim/neovim/issues/3460 oh crap 🤯
Every edit emits 3 events for me:
[0] events [
[0] {
[0] path: '/Users/jandudulski/eventcatalog/events/ProductDeleted/4913',
[0] type: 'delete'
[0] },
[0] {
[0] path: '/Users/jandudulski/eventcatalog/events/ProductDeleted/index.md',
[0] type: 'create'
[0] },
[0] {
[0] path: '/Users/jandudulski/eventcatalog/events/ProductDeleted/index.md~',
[0] type: 'delete'
[0] }
[0] ]
I simply add a check to watcher for delete event:
// IF directory remove it
if (type === 'delete' && fs.existsSync(newPath)) {
fs.rmSync(newPath);
}
And it seems to work but discovered another issue - in neovim I got create event instead of update 🙃
edit: like here https://github.com/parcel-bundler/watcher/issues/98
@gs-jdudulski
I'm working in a refactor to watcher to handle more edge cases and your scenario is covered there. (PR #764)
This PR handle create
and update
event in the same way.
I merged the changes from @carlosallexandre into the main build, although I still need to merge tests from #764 into the prod build. @gs-jdudulski let us know if you still have issues, will close for now, feel free to re-open if you find any problems.
I tried this:
npx eventcatalog dev
ornpm run dev
on nodes20.18.0
and22.5.1
This happened:
Each change raises error:
I expected this:
Reload server with changes applied
Is there a workaround?
Stop the server and start again
Anything else?
No response
EventCatalog Version
2.8.2
Node.js Version
22.5.1
Platform(s)
MacOS
Community Notes