#afterChange global hook is called twice??
9 messages ยท Page 1 of 1 (latest)
Thanks for the report. This does appear to be a bug. I'll get a fix going ๐
is there an ETA on this? (should I just make own workaround for now)
I would say next couple of days. I have a fix branch created, just needs some testing
A temporary fix but I just used a boolean to trigger one deploy
let UPDATED = false;
...
hooks: {
afterChange: [async () => {
if(process.env.NODE_ENV === "production" && !UPDATED) {
UPDATED = true;
await fetch(process.env.CLOUDFLARE_HOOK_URL, {
method: 'POST'
}).then(res => res.ok ? res.json() : Promise.reject(res))
.catch(err => console.error(err));
} else if(UPDATED) {
UPDATED = false;
}
}]
}
The fix has been merged and will be in the next release. That'll likely be this week, not sure when yet though - since we're doing our Launch Week.
yup that's what I did :)
thank you!! What's the Launch Week?
We'll be releasing a new feature or announcing something exciting every day this week. Today's announcement is open-sourcing our entire website that runs on Payload. You can read more here: