@payloadcms/ui 3.32.0-internal.ef3356b → 3.32.0-internal.f2e77bd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/elements/Autosave/index.d.ts.map +1 -1
  2. package/dist/elements/Autosave/index.js +20 -42
  3. package/dist/elements/Autosave/index.js.map +1 -1
  4. package/dist/exports/client/index.js +23 -23
  5. package/dist/exports/client/index.js.map +3 -3
  6. package/dist/fields/Array/index.d.ts.map +1 -1
  7. package/dist/fields/Array/index.js +46 -50
  8. package/dist/fields/Array/index.js.map +1 -1
  9. package/dist/fields/Blocks/index.d.ts.map +1 -1
  10. package/dist/fields/Blocks/index.js +46 -50
  11. package/dist/fields/Blocks/index.js.map +1 -1
  12. package/dist/forms/Form/fieldReducer.d.ts.map +1 -1
  13. package/dist/forms/Form/fieldReducer.js +51 -8
  14. package/dist/forms/Form/fieldReducer.js.map +1 -1
  15. package/dist/forms/Form/index.d.ts.map +1 -1
  16. package/dist/forms/Form/index.js +29 -14
  17. package/dist/forms/Form/index.js.map +1 -1
  18. package/dist/forms/Form/initContextState.d.ts.map +1 -1
  19. package/dist/forms/Form/initContextState.js +1 -0
  20. package/dist/forms/Form/initContextState.js.map +1 -1
  21. package/dist/forms/Form/mergeServerFormState.d.ts.map +1 -1
  22. package/dist/forms/Form/mergeServerFormState.js +24 -6
  23. package/dist/forms/Form/mergeServerFormState.js.map +1 -1
  24. package/dist/forms/Form/types.d.ts +5 -0
  25. package/dist/forms/Form/types.d.ts.map +1 -1
  26. package/dist/forms/Form/types.js.map +1 -1
  27. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts.map +1 -1
  28. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +0 -2
  29. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
  30. package/dist/hooks/useQueues.d.ts +34 -1
  31. package/dist/hooks/useQueues.d.ts.map +1 -1
  32. package/dist/hooks/useQueues.js +44 -28
  33. package/dist/hooks/useQueues.js.map +1 -1
  34. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"useQueues.js","names":["useCallback","useRef","useQueues","runningTaskRef","queuedTask","abortControllerRef","queueTask","fn","current","abort","executeTask","taskToRun","controller","AbortController","signal","err","name","console","error"],"sources":["../../src/hooks/useQueues.ts"],"sourcesContent":["import { useCallback, useRef } from 'react'\n\nexport function useQueues(): {\n queueTask: (fn: (signal: AbortSignal) => Promise<void>) => void\n} {\n const runningTaskRef = useRef<null | Promise<void>>(null)\n const queuedTask = useRef<((signal: AbortSignal) => Promise<void>) | null>(null)\n const abortControllerRef = useRef<AbortController | null>(null)\n\n const queueTask = useCallback((fn: (signal: AbortSignal) => Promise<void>) => {\n // Overwrite the queued task every time a new one arrives\n queuedTask.current = fn\n\n // If a task is already running, abort it and return\n if (runningTaskRef.current !== null) {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort()\n }\n\n return\n }\n\n const executeTask = async () => {\n while (queuedTask.current) {\n const taskToRun = queuedTask.current\n queuedTask.current = null // Reset latest task before running\n\n const controller = new AbortController()\n abortControllerRef.current = controller\n\n try {\n runningTaskRef.current = taskToRun(controller.signal)\n await runningTaskRef.current // Wait for the task to complete\n } catch (err) {\n if (err.name !== 'AbortError') {\n console.error('Error in queued function:', err) // eslint-disable-line no-console\n }\n } finally {\n runningTaskRef.current = null\n }\n }\n }\n\n void executeTask()\n }, [])\n\n return { queueTask }\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ;AAEpC,OAAO,SAASC,UAAA;EAGd,MAAMC,cAAA,GAAiBF,MAAA,CAA6B;EACpD,MAAMG,UAAA,GAAaH,MAAA,CAAwD;EAC3E,MAAMI,kBAAA,GAAqBJ,MAAA,CAA+B;EAE1D,MAAMK,SAAA,GAAYN,WAAA,CAAaO,EAAA;IAC7B;IACAH,UAAA,CAAWI,OAAO,GAAGD,EAAA;IAErB;IACA,IAAIJ,cAAA,CAAeK,OAAO,KAAK,MAAM;MACnC,IAAIH,kBAAA,CAAmBG,OAAO,EAAE;QAC9BH,kBAAA,CAAmBG,OAAO,CAACC,KAAK;MAClC;MAEA;IACF;IAEA,MAAMC,WAAA,GAAc,MAAAA,CAAA;MAClB,OAAON,UAAA,CAAWI,OAAO,EAAE;QACzB,MAAMG,SAAA,GAAYP,UAAA,CAAWI,OAAO;QACpCJ,UAAA,CAAWI,OAAO,GAAG,KAAK;QAAA;QAE1B,MAAMI,UAAA,GAAa,IAAIC,eAAA;QACvBR,kBAAA,CAAmBG,OAAO,GAAGI,UAAA;QAE7B,IAAI;UACFT,cAAA,CAAeK,OAAO,GAAGG,SAAA,CAAUC,UAAA,CAAWE,MAAM;UACpD,MAAMX,cAAA,CAAeK,OAAO,CAAC;UAAA;QAC/B,EAAE,OAAOO,GAAA,EAAK;UACZ,IAAIA,GAAA,CAAIC,IAAI,KAAK,cAAc;YAC7BC,OAAA,CAAQC,KAAK,CAAC,6BAA6BH,GAAA,EAAK;YAAA;UAClD;QACF,UAAU;UACRZ,cAAA,CAAeK,OAAO,GAAG;QAC3B;MACF;IACF;IAEA,KAAKE,WAAA;EACP,GAAG,EAAE;EAEL,OAAO;IAAEJ;EAAU;AACrB","ignoreList":[]}
1
+ {"version":3,"file":"useQueues.js","names":["useCallback","useRef","useQueues","queue","isProcessing","queueTask","fn","options","current","push","processQueue","beforeProcess","shouldContinue","length","latestTask","pop","err","console","error","afterProcess"],"sources":["../../src/hooks/useQueues.ts"],"sourcesContent":["import { useCallback, useRef } from 'react'\n\ntype QueuedFunction = () => Promise<void>\n\ntype QueuedTaskOptions = {\n /**\n * A function that is called after the queue has processed a function\n * Used to perform side effects after processing the queue\n * @returns {void}\n */\n afterProcess?: () => void\n /**\n * A function that can be used to prevent the queue from processing under certain conditions\n * Can also be used to perform side effects before processing the queue\n * @returns {boolean} If `false`, the queue will not process\n */\n beforeProcess?: () => boolean\n}\n\ntype QueueTask = (fn: QueuedFunction, options?: QueuedTaskOptions) => void\n\n/**\n * A React hook that allows you to queue up functions to be executed in order.\n * This is useful when you need to ensure long running networks requests are processed sequentially.\n * Builds up a \"queue\" of functions to be executed in order, only ever processing the last function in the queue.\n * This ensures that a long queue of tasks doesn't cause a backlog of tasks to be processed.\n * E.g. if you queue a task and it begins running, then you queue 9 more tasks:\n * 1. The currently task will finish\n * 2. The next task in the queue will run\n * 3. All remaining tasks will be discarded\n * @returns {queueTask} A function used to queue a function.\n * @example\n * const { queueTask } = useQueues()\n * queueTask(async () => {\n * await fetch('https://api.example.com')\n * })\n */\nexport function useQueues(): {\n queueTask: QueueTask\n} {\n const queue = useRef<QueuedFunction[]>([])\n\n const isProcessing = useRef(false)\n\n const queueTask = useCallback<QueueTask>((fn, options) => {\n queue.current.push(fn)\n\n async function processQueue() {\n if (isProcessing.current) {\n return\n }\n\n // Allow the consumer to prevent the queue from processing under certain conditions\n if (typeof options?.beforeProcess === 'function') {\n const shouldContinue = options.beforeProcess()\n\n if (shouldContinue === false) {\n return\n }\n }\n\n while (queue.current.length > 0) {\n const latestTask = queue.current.pop() // Only process the last task in the queue\n queue.current = [] // Discard all other tasks\n\n isProcessing.current = true\n\n try {\n await latestTask()\n } catch (err) {\n console.error('Error in queued function:', err) // eslint-disable-line no-console\n } finally {\n isProcessing.current = false\n\n if (typeof options?.afterProcess === 'function') {\n options.afterProcess()\n }\n }\n }\n }\n\n void processQueue()\n }, [])\n\n return { queueTask }\n}\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ;AAqBpC;;;;;;;;;;;;;;;;AAgBA,OAAO,SAASC,UAAA;EAGd,MAAMC,KAAA,GAAQF,MAAA,CAAyB,EAAE;EAEzC,MAAMG,YAAA,GAAeH,MAAA,CAAO;EAE5B,MAAMI,SAAA,GAAYL,WAAA,CAAuB,CAACM,EAAA,EAAIC,OAAA;IAC5CJ,KAAA,CAAMK,OAAO,CAACC,IAAI,CAACH,EAAA;IAEnB,eAAeI,aAAA;MACb,IAAIN,YAAA,CAAaI,OAAO,EAAE;QACxB;MACF;MAEA;MACA,IAAI,OAAOD,OAAA,EAASI,aAAA,KAAkB,YAAY;QAChD,MAAMC,cAAA,GAAiBL,OAAA,CAAQI,aAAa;QAE5C,IAAIC,cAAA,KAAmB,OAAO;UAC5B;QACF;MACF;MAEA,OAAOT,KAAA,CAAMK,OAAO,CAACK,MAAM,GAAG,GAAG;QAC/B,MAAMC,UAAA,GAAaX,KAAA,CAAMK,OAAO,CAACO,GAAG,GAAG;QAAA;QACvCZ,KAAA,CAAMK,OAAO,GAAG,EAAE,CAAC;QAAA;QAEnBJ,YAAA,CAAaI,OAAO,GAAG;QAEvB,IAAI;UACF,MAAMM,UAAA;QACR,EAAE,OAAOE,GAAA,EAAK;UACZC,OAAA,CAAQC,KAAK,CAAC,6BAA6BF,GAAA,EAAK;UAAA;QAClD,UAAU;UACRZ,YAAA,CAAaI,OAAO,GAAG;UAEvB,IAAI,OAAOD,OAAA,EAASY,YAAA,KAAiB,YAAY;YAC/CZ,OAAA,CAAQY,YAAY;UACtB;QACF;MACF;IACF;IAEA,KAAKT,YAAA;EACP,GAAG,EAAE;EAEL,OAAO;IAAEL;EAAU;AACrB","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/ui",
3
- "version": "3.32.0-internal.ef3356b",
3
+ "version": "3.32.0-internal.f2e77bd",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -132,7 +132,7 @@
132
132
  "ts-essentials": "10.0.3",
133
133
  "use-context-selector": "2.0.0",
134
134
  "uuid": "10.0.0",
135
- "@payloadcms/translations": "3.32.0-internal.ef3356b"
135
+ "@payloadcms/translations": "3.32.0-internal.f2e77bd"
136
136
  },
137
137
  "devDependencies": {
138
138
  "@babel/cli": "7.26.4",
@@ -148,14 +148,14 @@
148
148
  "esbuild": "0.24.2",
149
149
  "esbuild-sass-plugin": "3.3.1",
150
150
  "eslint-plugin-react-compiler": "19.0.0-beta-714736e-20250131",
151
- "payload": "3.32.0-internal.ef3356b",
151
+ "payload": "3.32.0-internal.f2e77bd",
152
152
  "@payloadcms/eslint-config": "3.28.0"
153
153
  },
154
154
  "peerDependencies": {
155
155
  "next": "^15.2.3",
156
156
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
157
157
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
158
- "payload": "3.32.0-internal.ef3356b"
158
+ "payload": "3.32.0-internal.f2e77bd"
159
159
  },
160
160
  "engines": {
161
161
  "node": "^18.20.2 || >=20.9.0"