Open
Description
I'm working on a plugin that adds a new collection with a few fields and hooks. Hot reload is working perfectly when I add new fields
to the new collection—they instantly show up on the dashboard. But if I had new collection hooks, the changes aren't captured. I have to stop and restart the server for changes to the collection's hooks to be picked up.
I tried both anonymous inline functions in beforeChange
hooks: {
beforeChange: [() => { console.log('only shows up after manually restarting server') }]
}
and importing the hook from a separate file like in the docs:
import { CollectionBeforeChangeHook } from "payload/types";
const beforeChangeHook: CollectionBeforeChangeHook = async ({
}) => {
console.log('still only shows up after manually restarting server');
};
export default beforeChangeHook;
Any thoughts on why hooks might be cached or not captured, or if I might have something wrong in my set-up?
The collection is being added per the example:
config.collections = [
...(config.collections || []),
// Add additional collections here
Videos
]
Metadata
Metadata
Assignees
Labels
No labels