Skip to content

Duplicate posts when running on dev #158

@r4mmer

Description

@r4mmer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions