4awpawz / trio

Fast, simple yet powerful JavaScript-driven static site generation.

Home Page:https://gettriossg.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

refactor garbage collection to use destination path as well as source path

jeffschwartz opened this issue · comments

When a user changes a blog article's category, garbage collection fails to delete the original article.

Garbage collection currently handles identifying target pages that are no longer generated by comparing cached stats to new stats, specifically by their source paths.

Garbage collection, however, does not currently handle identifying orphaned pages that are the result of the user changing the categories associated with articles. This results in the generation of duplicate articles located at their new paths reflecting their new categories and the failure of garbage collection to remove the original articles located at the paths reflected by their previous categories.

To correct this issue, all targets for garbage collection must be determined after getAllMetadata has been called. This will then allow for also comparing the current stat's destination path to the cached stats destination path. If they aren't the same then garbage collection will target the cached stat's destination path for removal.