Admin link-preview hook never throws without a Payload instance
syncAdminMeta returned to payload.logger in its catch even when payload was
undefined, so the Site settings afterChange hook threw with req: {} (an
unhandled rejection that made vitest, and npm publish for 1.14.5, exit 1).
Return early without payload, log through payload?.logger, skip the call in the
hook without req.payload; the fillEmptyLocales hooks get the same guard. Tests:
sync without payload, and every plugin global afterChange hook with req: {}.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
838a2f70b2
commit
71f7108cb8
+1
-1
@@ -401,7 +401,7 @@ export const ipalKit = (options: IpalOptions): Plugin => {
|
||||
afterChange: [
|
||||
...(g.hooks?.afterChange ?? []),
|
||||
async ({ doc, req }) => {
|
||||
await syncAdminMeta(req.payload, resolved, { nameField: brandFields.nameField, settingsSlug })
|
||||
if (req?.payload) {await syncAdminMeta(req.payload, resolved, { nameField: brandFields.nameField, settingsSlug })}
|
||||
return doc
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user