fiddle icon indicating copy to clipboard operation
fiddle copied to clipboard

Bug: Does not reload file contents if changed externally (e.g. an IDE)

Open powellnorma opened this issue 6 months ago • 5 comments

powellnorma avatar Aug 16 '25 16:08 powellnorma

We can probably implement something using fs.watch() to do this!

codebytere avatar Aug 18 '25 18:08 codebytere

Agreed, like in Notepad++ or any other editor, it would monitor/watch file contents change in real-time and notify the user - whether to load changes or ignore / keep as is - so user can choose either option then continue

St1g3rOptlm1S3 avatar Aug 21 '25 04:08 St1g3rOptlm1S3

I think it would be good if it reloaded silently unless there are unsaved changes. In the latter case, it could behave like VSCode or Vim, prompting the user only upon saving with a message like this:

WARNING: The file has been changed since reading it!!!
Do you really want to write to it (y/n)?

powellnorma avatar Aug 21 '25 06:08 powellnorma

@codebytere would love to implement this, can I try ?

RNAdvani avatar Aug 23 '25 11:08 RNAdvani

@codebytere I found two ways, we can implement this, it's by using the fs.watch as u had mentioned or we can use chokidar which is a watcher and would help in duplicate event triggers while watching and would handle it properly. Although the package is maintained and it gets updated regularly. should there be a solution which adds a dependency to the fiddle or should it be handled by fs

RNAdvani avatar Sep 02 '25 14:09 RNAdvani