Files
klz-cables.com/.pnpm-store/v10/files/fa/f17877c585c18edb1ad57e55ad6d7feb13916b74c041e87f589d2e3a2ff5eab0550405d06fbdf691ef00b2abc6b5bf50cb267388f9e8e027fb1c1bf09eff0e
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
3.2 KiB
Plaintext

{"version":3,"file":"handleTakeOver.js","names":["handleTakeOver","id","clearRouteCache","collectionSlug","documentLockStateRef","globalSlug","isLockingEnabled","isWithinDoc","setCurrentEditor","setIsReadOnlyForIncomingUser","updateDocumentEditor","user","current","hasShownLockedModal","isLocked","error","console"],"sources":["../../src/utilities/handleTakeOver.tsx"],"sourcesContent":["import type { ClientUser } from 'payload'\n\nexport interface HandleTakeOverParams {\n clearRouteCache?: () => void\n collectionSlug?: string\n documentLockStateRef: React.RefObject<{\n hasShownLockedModal: boolean\n isLocked: boolean\n user: ClientUser | number | string\n }>\n globalSlug?: string\n id: number | string\n isLockingEnabled: boolean\n isWithinDoc: boolean\n setCurrentEditor: (value: React.SetStateAction<ClientUser | number | string>) => void\n setIsReadOnlyForIncomingUser?: (value: React.SetStateAction<boolean>) => void\n updateDocumentEditor: (\n docID: number | string,\n slug: string,\n user: ClientUser | number | string,\n ) => Promise<void>\n user: ClientUser | number | string\n}\n\nexport const handleTakeOver = async ({\n id,\n clearRouteCache,\n collectionSlug,\n documentLockStateRef,\n globalSlug,\n isLockingEnabled,\n isWithinDoc,\n setCurrentEditor,\n setIsReadOnlyForIncomingUser,\n updateDocumentEditor,\n user,\n}: HandleTakeOverParams): Promise<void> => {\n if (!isLockingEnabled) {\n return\n }\n\n try {\n // Call updateDocumentEditor to update the document's owner to the current user\n await updateDocumentEditor(id, collectionSlug ?? globalSlug, user)\n\n if (!isWithinDoc) {\n documentLockStateRef.current.hasShownLockedModal = true\n }\n\n // Update the locked state to reflect the current user as the owner\n documentLockStateRef.current = {\n hasShownLockedModal: documentLockStateRef.current?.hasShownLockedModal,\n isLocked: true,\n user,\n }\n setCurrentEditor(user)\n\n // If this is a takeover within the document, ensure the document is editable\n if (isWithinDoc && setIsReadOnlyForIncomingUser) {\n setIsReadOnlyForIncomingUser(false)\n }\n\n // Need to clear the route cache to refresh the page and update readOnly state for server rendered components\n if (clearRouteCache) {\n clearRouteCache()\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error during document takeover:', error)\n }\n}\n"],"mappings":"AAwBA,OAAO,MAAMA,cAAA,GAAiB,MAAAA,CAAO;EACnCC,EAAE;EACFC,eAAe;EACfC,cAAc;EACdC,oBAAoB;EACpBC,UAAU;EACVC,gBAAgB;EAChBC,WAAW;EACXC,gBAAgB;EAChBC,4BAA4B;EAC5BC,oBAAoB;EACpBC;AAAI,CACiB;EACrB,IAAI,CAACL,gBAAA,EAAkB;IACrB;EACF;EAEA,IAAI;IACF;IACA,MAAMI,oBAAA,CAAqBT,EAAA,EAAIE,cAAA,IAAkBE,UAAA,EAAYM,IAAA;IAE7D,IAAI,CAACJ,WAAA,EAAa;MAChBH,oBAAA,CAAqBQ,OAAO,CAACC,mBAAmB,GAAG;IACrD;IAEA;IACAT,oBAAA,CAAqBQ,OAAO,GAAG;MAC7BC,mBAAA,EAAqBT,oBAAA,CAAqBQ,OAAO,EAAEC,mBAAA;MACnDC,QAAA,EAAU;MACVH;IACF;IACAH,gBAAA,CAAiBG,IAAA;IAEjB;IACA,IAAIJ,WAAA,IAAeE,4BAAA,EAA8B;MAC/CA,4BAAA,CAA6B;IAC/B;IAEA;IACA,IAAIP,eAAA,EAAiB;MACnBA,eAAA;IACF;EACF,EAAE,OAAOa,KAAA,EAAO;IACd;IACAC,OAAA,CAAQD,KAAK,CAAC,mCAAmCA,KAAA;EACnD;AACF","ignoreList":[]}