Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File watching should handle rename events #49

Closed
mbostock opened this issue Oct 23, 2023 · 3 comments
Closed

File watching should handle rename events #49

mbostock opened this issue Oct 23, 2023 · 3 comments
Assignees
Labels
bug Something isn’t working good first issue Good for newcomers

Comments

@mbostock
Copy link
Member

Currently our file watcher only handles change events. This means that a command such as git checkout docs/index.md which generates a rename event is ignored, and then the file watcher becomes detached from the file and no longer reports any changes.

https://github.com/observablehq/cli/blob/0081db4f685ef635df42d0725ec2bbac5e87fa6c/src/preview.ts#L142

@mbostock mbostock added bug Something isn’t working good first issue Good for newcomers labels Oct 23, 2023
@prichey prichey self-assigned this Oct 24, 2023
@prichey
Copy link
Contributor

prichey commented Oct 25, 2023

@mbostock What is the desired behavior in the event of an actual rename?

E.g. mv docs/javascript.md docs/javascript-foo.md. If at /javascript, would you expect the page to reload and stay at the same URL (which would now 404), or would you expect a redirect to the new URL? The trivial solution would be to emit a reload, though it might be nice to location.assign (or location.replace?) to the new URL

@mbostock
Copy link
Member Author

@prichey I’d start by making the git checkout use case described above function as intended. I’m not sure we need to support pages getting renamed and redirecting.

@mbostock
Copy link
Member Author

Fixed in #64 #67.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants