framework icon indicating copy to clipboard operation
framework copied to clipboard

Watch data loader creation and file renaming

Open Fil opened this issue 1 year ago • 2 comments

If you add a new data loader, it should show up live in the preview server. Same if you rename a data loader from data.csv.sh to data.csv.js.

Fil avatar Nov 08 '23 19:11 Fil

I think this would require a recursive watch on the source root?

mbostock avatar Nov 10 '23 05:11 mbostock

To be more specific, I think the OP is describing this error case:

  1. You try to load a file that doesn’t exist yet (e.g., foo.csv)
  2. You later add a data loader for that file (e.g., foo.csv.js)

Since neither foo.csv nor foo.csv.js existed at the time the file was referenced, we’re not able to watch the corresponding file. And since we don’t watch the directory, we won’t notice when you subsequently add a foo.csv.js. However, the inverse scenario works fine, when you add foo.csv.js first, and then load foo.csv. And the workaround here is pretty simple — you just reload the page. But it would be nice to fix, and I think we should consider this a bug in file watching/hot module reloading.

mbostock avatar Nov 13 '23 19:11 mbostock