Skip to content

Track entries in collections with a custom entry class - #45

Merged
ryanmitchell merged 2 commits into
thoughtco:mainfrom
daun:fix/track-custom-entry-class
Sep 18, 2026
Merged

ryanmitchell merged 2 commits into
thoughtco:mainfrom
daun:fix/track-custom-entry-class

Conversation

@daun

@daun daun commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Entries in collections with a custom entry_class are never tracked. Saving one invalidates nothing and the pages rendering it stay stale. The reason is the exact class being hooked: the augmentation hook is filed under Entry and looked up under e.g. ProductEntry, so it never fires.

The fix registers the hook on every entry class in existence. Reusing the closure is safe since runHooks() rebinds per call. Entries are the only affected case, so the other hooks are unchanged.

Added tests that fail on main and pass here.

@ryanmitchell

Copy link
Copy Markdown
Contributor

Cool, thanks!

@ryanmitchell
ryanmitchell merged commit 54d738a into thoughtco:main Sep 18, 2026
2 checks passed
@daun
daun deleted the fix/track-custom-entry-class branch September 18, 2026 11:18
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

Successfully merging this pull request may close these issues.

2 participants