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

Duplicate posts when running on dev #158

Open
r4mmer opened this issue Nov 18, 2024 · 1 comment
Open

Duplicate posts when running on dev #158

r4mmer opened this issue Nov 18, 2024 · 1 comment

Comments

@r4mmer
Copy link

r4mmer commented Nov 18, 2024

During development If we edit a blog post in a way that changes the pathname (for instance editing pathname in front matter) the rendered list of posts will have the old and new entries.

The reason is that POSTS is a map of pathname to Post and when the pathname changes the old post (under the old pathname) is not updated or removed.

Since the watchFs event does not return the old state of the file we don't really know what changed.
I think maybe a Map<string, string> of filename to pathname can help, when this file changes we remove the pathname entry from POSTS (since we know the old pathname) before loadPost.

I did not check yet but I think the worst case is rename, in this case we would need to scan all files and check which filename is not present and delete it from POSTS.

@r4mmer
Copy link
Author

r4mmer commented Nov 18, 2024

I can create the PR but I don't know if this is already known or even a desired fix (since its an edge case)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant