Add “Watcher” Mode to Monitor Local File Changes#512
Add “Watcher” Mode to Monitor Local File Changes#512eliyya wants to merge 19 commits intoAykutSarac:mainfrom
Conversation
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
|
I ran into an error when I clicked the Watcher button, we should add I like the idea though, good job! Let's wait for comments on the PR for now. 🏁 |
atilaahmettaner
left a comment
There was a problem hiding this comment.
The initial watch state does not transfer the file to the editor, it transfers it when changes are made. Can you also resolve the initial watch state here?
There was a problem hiding this comment.
I tested the watch mode on Chrome overall and it works well. File updates from an external editor trigger the "File updated!" toast properly, the editor goes read-only as expected, and the graph refreshes correctly. Good job on the implementation.
However I found a few issues:
- Initial file content not loading on first watch
When I first open the app and click the Watcher button, the selected file's content doesn't load into the editor. The old content stays. It gets updated only when the file is modified externally. This doesn't happen every time but specifically when you first open the app and immediately start watch mode.
- Closing the modal stops watch mode
If watch mode is active and you open the Import Modal again and close it, watch mode gets stopped. The onClose handler calls toggleWatchMode(false) which kills the watcher. The user might just want to close the modal, not stop watching.
toggleWatchMode(false);
this stops watch mode unintentionally
- console.log left in code
There's a console.log(file) left in the import handler that should be removed before merging.
|
@eliyya looks good, just a small typo — "suported" should be "supported" in the tooltip text. other than that everything works fine 👍 |
I can't reproduce this bug. In the initials commits I fixed that, so, I don't know if the bug i'ts appearing again or i'ts an old bug. It still appearing yet? Im still usin a lot the watcher, tnx for the feedback and sorry for the typos, english is not my first language |

Description
This PR introduces a new “Watcher” mode under the File > Import menu, allowing users to monitor changes to a selected local file and automatically update the editor and graph.
Motivation
I work a lot with generating JSON files and I use jsoncrack.com a lot to view the generation, but having to re-import the JSON every time it is regenerated really disrupts my workflow. jsoncrack.com is already perfect, but I thought that if the tool had a watch mode it would be much better, so I implemented that option.
Implementation Details
window.showOpenFilePicker) opens for the user to select a file.setIntervalruns every 3 seconds to check for changes usingfileHandle.getFile().Benefits