From 4119eec796794d6a026f34f8b097b379eb9895a0 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Dec 2021 10:56:36 -0500 Subject: [PATCH 01/11] fix: cross-browser upload drag and drop --- .../views/collections/Edit/Upload/index.tsx | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/admin/components/views/collections/Edit/Upload/index.tsx b/src/admin/components/views/collections/Edit/Upload/index.tsx index ca8f5ddf44..3ae1e9204b 100644 --- a/src/admin/components/views/collections/Edit/Upload/index.tsx +++ b/src/admin/components/views/collections/Edit/Upload/index.tsx @@ -27,7 +27,6 @@ const validate = (value) => { const Upload: React.FC = (props) => { const inputRef = useRef(null); const dropRef = useRef(null); - const [fileList, setFileList] = useState(undefined); const [selectingFile, setSelectingFile] = useState(false); const [dragging, setDragging] = useState(false); const [dragCounter, setDragCounter] = useState(0); @@ -53,16 +52,16 @@ const Upload: React.FC = (props) => { const handleDragIn = useCallback((e) => { e.preventDefault(); e.stopPropagation(); - setDragCounter(dragCounter + 1); + setDragCounter((count) => count + 1); if (e.dataTransfer.items && e.dataTransfer.items.length > 0) { setDragging(true); } - }, [dragCounter]); + }, []); const handleDragOut = useCallback((e) => { e.preventDefault(); e.stopPropagation(); - setDragCounter(dragCounter - 1); + setDragCounter((count) => count - 1); if (dragCounter > 1) return; setDragging(false); }, [dragCounter]); @@ -73,7 +72,7 @@ const Upload: React.FC = (props) => { setDragging(false); if (e.dataTransfer.files && e.dataTransfer.files.length > 0) { - setFileList(e.dataTransfer.files); + setValue(e.dataTransfer.files[0]); setDragging(false); e.dataTransfer.clearData(); @@ -81,11 +80,13 @@ const Upload: React.FC = (props) => { } else { setDragging(false); } - }, []); + }, [setValue]); + // Only called when input is interacted with directly + // Not called when drag + drop is used + // Or when input is cleared const handleInputChange = useCallback(() => { setSelectingFile(false); - setFileList(inputRef?.current?.files || null); setValue(inputRef?.current?.files?.[0] || null); }, [inputRef, setValue]); @@ -113,13 +114,7 @@ const Upload: React.FC = (props) => { } return () => null; - }, [handleDragIn, handleDragOut, handleDrop, dropRef]); - - useEffect(() => { - if (inputRef.current && fileList !== undefined) { - inputRef.current.files = fileList; - } - }, [fileList]); + }, [handleDragIn, handleDragOut, handleDrop, value]); useEffect(() => { setReplacingFile(false); @@ -143,7 +138,6 @@ const Upload: React.FC = (props) => { collection={collection} handleRemove={() => { setReplacingFile(true); - setFileList(null); setValue(null); }} /> @@ -163,7 +157,6 @@ const Upload: React.FC = (props) => { buttonStyle="icon-label" iconStyle="with-border" onClick={() => { - setFileList(null); setValue(null); }} /> From 9e091af67e944e6a15d1d1174a18cde6deda40d7 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Dec 2021 11:03:20 -0500 Subject: [PATCH 02/11] fix: ensures row count is set properly in block fields --- src/admin/components/forms/field-types/Blocks/Blocks.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/admin/components/forms/field-types/Blocks/Blocks.tsx b/src/admin/components/forms/field-types/Blocks/Blocks.tsx index d6a18f20ce..77baf2bf61 100644 --- a/src/admin/components/forms/field-types/Blocks/Blocks.tsx +++ b/src/admin/components/forms/field-types/Blocks/Blocks.tsx @@ -141,6 +141,8 @@ const Blocks: React.FC = (props) => { moveRow(sourceIndex, destinationIndex); }, [moveRow]); + // Get preferences, and once retrieved, + // Reset rows with preferences included useEffect(() => { const fetchPreferences = async () => { const preferences = preferencesKey ? await getPreference(preferencesKey) : undefined; @@ -151,6 +153,12 @@ const Blocks: React.FC = (props) => { fetchPreferences(); }, [formContext, path, preferencesKey, getPreference]); + // Set row count on mount and when form context is reset + useEffect(() => { + const data = formContext.getDataByPath(path); + dispatchRows({ type: 'SET_ALL', data: data || [] }); + }, [formContext, path]); + useEffect(() => { setValue(rows?.length || 0); From ec6453bb5f5b55e5b54f42ec695288420af44e2e Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Dec 2021 15:08:53 -0500 Subject: [PATCH 03/11] chore: beta release --- CHANGELOG.md | 22 ++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 383d56f172..f94091ce41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ +## [0.13.14-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.14-beta.0) (2021-12-29) + + +### Bug Fixes + +* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) +* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) +* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) +* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) +* cross-browser upload drag and drop ([4119eec](https://github.com/payloadcms/payload/commit/4119eec796794d6a026f34f8b097b379eb9895a0)) +* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4)) +* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3)) +* ensures row count is set properly in block fields ([9e091af](https://github.com/payloadcms/payload/commit/9e091af67e944e6a15d1d1174a18cde6deda40d7)) +* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade)) + + +### Features + +* builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b)) +* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7)) +* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b)) + ## [0.13.13-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.13-beta.0) (2021-12-28) diff --git a/package.json b/package.json index 1053cd8c80..4c9ecb70fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "0.13.13-beta.0", + "version": "0.13.14-beta.0", "description": "Node, React and MongoDB Headless CMS and Application Framework", "license": "SEE LICENSE IN license.md", "author": { @@ -35,6 +35,7 @@ "demo:build:analyze": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.ts PAYLOAD_ANALYZE_BUNDLE=true node dist/bin/build", "demo:build": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.ts node dist/bin/build", "demo:generate:types": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.ts node dist/bin/generateTypes", + "demo:serve": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.ts NODE_ENV=production nodemon", "dev": "cross-env PAYLOAD_CONFIG_PATH=demo/payload.config.ts nodemon", "test": "yarn test:int && yarn test:client", "pretest": "yarn build", From 961787d681882e5ab48bb676490555c93f5d4a2e Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Dec 2021 15:09:08 -0500 Subject: [PATCH 04/11] fix: ensures searching relationships works with many pages of results --- src/admin/components/forms/field-types/Relationship/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/admin/components/forms/field-types/Relationship/index.tsx b/src/admin/components/forms/field-types/Relationship/index.tsx index 17ea530efc..cf8dda5a69 100644 --- a/src/admin/components/forms/field-types/Relationship/index.tsx +++ b/src/admin/components/forms/field-types/Relationship/index.tsx @@ -48,7 +48,6 @@ const Relationship: React.FC = (props) => { collections, } = useConfig(); - const formProcessing = useFormProcessing(); const hasMultipleRelations = Array.isArray(relationTo); @@ -308,7 +307,7 @@ const Relationship: React.FC = (props) => { } } : undefined} onMenuScrollToBottom={() => { - getResults({ lastFullyLoadedRelation, lastLoadedPage: lastLoadedPage + 1 }); + getResults({ lastFullyLoadedRelation, lastLoadedPage: lastLoadedPage + 1, search }); }} value={valueToRender} showError={showError} From 546e6e56f153fd0430ecf1afcafe3716cbed595a Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Dec 2021 15:29:05 -0500 Subject: [PATCH 05/11] chore: beta release --- CHANGELOG.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f94091ce41..53275e8f7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,49 @@ +## [0.13.16-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.16-beta.0) (2021-12-29) + + +### Bug Fixes + +* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) +* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) +* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) +* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) +* cross-browser upload drag and drop ([4119eec](https://github.com/payloadcms/payload/commit/4119eec796794d6a026f34f8b097b379eb9895a0)) +* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4)) +* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3)) +* ensures row count is set properly in block fields ([9e091af](https://github.com/payloadcms/payload/commit/9e091af67e944e6a15d1d1174a18cde6deda40d7)) +* ensures searching relationships works with many pages of results ([961787d](https://github.com/payloadcms/payload/commit/961787d681882e5ab48bb676490555c93f5d4a2e)) +* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade)) + + +### Features + +* builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b)) +* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7)) +* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b)) + +## [0.13.15-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.15-beta.0) (2021-12-29) + + +### Bug Fixes + +* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) +* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) +* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) +* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) +* cross-browser upload drag and drop ([4119eec](https://github.com/payloadcms/payload/commit/4119eec796794d6a026f34f8b097b379eb9895a0)) +* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4)) +* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3)) +* ensures row count is set properly in block fields ([9e091af](https://github.com/payloadcms/payload/commit/9e091af67e944e6a15d1d1174a18cde6deda40d7)) +* ensures searching relationships works with many pages of results ([961787d](https://github.com/payloadcms/payload/commit/961787d681882e5ab48bb676490555c93f5d4a2e)) +* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade)) + + +### Features + +* builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b)) +* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7)) +* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b)) + ## [0.13.14-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.14-beta.0) (2021-12-29) diff --git a/package.json b/package.json index 4c9ecb70fc..c409906bc4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "0.13.14-beta.0", + "version": "0.13.16-beta.0", "description": "Node, React and MongoDB Headless CMS and Application Framework", "license": "SEE LICENSE IN license.md", "author": { From a09570c78dc923f3553f36d726e5cfac925290a0 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Dec 2021 15:29:12 -0500 Subject: [PATCH 06/11] fix: 407 --- src/collections/operations/create.ts | 2 +- src/collections/operations/local/create.ts | 4 +++- src/collections/operations/local/update.ts | 4 +++- src/collections/operations/update.ts | 2 +- src/express/types.ts | 4 +++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/collections/operations/create.ts b/src/collections/operations/create.ts index 8b82e8fd55..96ba4d4f0c 100644 --- a/src/collections/operations/create.ts +++ b/src/collections/operations/create.ts @@ -94,7 +94,7 @@ async function create(this: Payload, incomingArgs: Arguments): Promise const { staticDir, imageSizes, disableLocalStorage } = collectionConfig.upload; - const file = ((req.files && req.files.file) ? req.files.file : req.file) as UploadedFile; + const { file } = req.files; if (!file) { throw new MissingFile(); diff --git a/src/collections/operations/local/create.ts b/src/collections/operations/local/create.ts index c96638daea..3d73870cbd 100644 --- a/src/collections/operations/local/create.ts +++ b/src/collections/operations/local/create.ts @@ -45,7 +45,9 @@ export default async function create(options: Options): Promise { locale, fallbackLocale, payload: this, - file: getFileByPath(filePath), + files: { + file: getFileByPath(filePath), + }, }, }); } diff --git a/src/collections/operations/local/update.ts b/src/collections/operations/local/update.ts index a445fd1c6c..c2bb7800d1 100644 --- a/src/collections/operations/local/update.ts +++ b/src/collections/operations/local/update.ts @@ -47,7 +47,9 @@ export default async function update(options: Option locale, fallbackLocale, payload: this, - file: getFileByPath(filePath), + files: { + file: getFileByPath(filePath), + }, }, }; diff --git a/src/collections/operations/update.ts b/src/collections/operations/update.ts index aa1317b266..895ab379ac 100644 --- a/src/collections/operations/update.ts +++ b/src/collections/operations/update.ts @@ -135,7 +135,7 @@ async function update(incomingArgs: Arguments): Promise { staticPath = path.resolve(config.paths.configDir, staticDir); } - const file = ((req.files && req.files.file) ? req.files.file : req.file) as UploadedFile; + const { file } = req.files; if (file) { const fsSafeName = !overwriteExistingFiles ? await getSafeFilename(Model, staticPath, file.name) : file.name; diff --git a/src/express/types.ts b/src/express/types.ts index e8b6644519..0fe53e4c47 100644 --- a/src/express/types.ts +++ b/src/express/types.ts @@ -11,7 +11,9 @@ export type PayloadRequest = Request & { fallbackLocale?: string; collection?: Collection; payloadAPI: 'REST' | 'local' | 'graphQL' - file?: UploadedFile + files?: { + file: UploadedFile + } user: User | null payloadUploadSizes?: Record findByID?: { From 2a8f5645008da97537f35bec31a9c12dd58b5f2d Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Dec 2021 15:33:20 -0500 Subject: [PATCH 07/11] chore: beta release --- CHANGELOG.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53275e8f7d..822ede0f16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,51 @@ +## [0.13.18-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.18-beta.0) (2021-12-29) + + +### Bug Fixes + +* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) +* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) +* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) +* 407 ([a09570c](https://github.com/payloadcms/payload/commit/a09570c78dc923f3553f36d726e5cfac925290a0)) +* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) +* cross-browser upload drag and drop ([4119eec](https://github.com/payloadcms/payload/commit/4119eec796794d6a026f34f8b097b379eb9895a0)) +* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4)) +* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3)) +* ensures row count is set properly in block fields ([9e091af](https://github.com/payloadcms/payload/commit/9e091af67e944e6a15d1d1174a18cde6deda40d7)) +* ensures searching relationships works with many pages of results ([961787d](https://github.com/payloadcms/payload/commit/961787d681882e5ab48bb676490555c93f5d4a2e)) +* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade)) + + +### Features + +* builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b)) +* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7)) +* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b)) + +## [0.13.17-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.17-beta.0) (2021-12-29) + + +### Bug Fixes + +* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) +* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) +* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) +* 407 ([a09570c](https://github.com/payloadcms/payload/commit/a09570c78dc923f3553f36d726e5cfac925290a0)) +* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) +* cross-browser upload drag and drop ([4119eec](https://github.com/payloadcms/payload/commit/4119eec796794d6a026f34f8b097b379eb9895a0)) +* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4)) +* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3)) +* ensures row count is set properly in block fields ([9e091af](https://github.com/payloadcms/payload/commit/9e091af67e944e6a15d1d1174a18cde6deda40d7)) +* ensures searching relationships works with many pages of results ([961787d](https://github.com/payloadcms/payload/commit/961787d681882e5ab48bb676490555c93f5d4a2e)) +* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade)) + + +### Features + +* builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b)) +* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7)) +* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b)) + ## [0.13.16-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.16-beta.0) (2021-12-29) diff --git a/package.json b/package.json index c409906bc4..abedcff11a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "0.13.16-beta.0", + "version": "0.13.18-beta.0", "description": "Node, React and MongoDB Headless CMS and Application Framework", "license": "SEE LICENSE IN license.md", "author": { From e2c5d93751cb1902d6dce2147953b97c2dc17939 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Dec 2021 15:49:47 -0500 Subject: [PATCH 08/11] fix: #408 --- demo/collections/Localized.ts | 5 +++ .../operations/local/local.spec.js | 35 +++++++++++++++++++ src/fields/traverseFields.ts | 3 ++ 3 files changed, 43 insertions(+) diff --git a/demo/collections/Localized.ts b/demo/collections/Localized.ts index 2b0f173d94..bb54821d64 100644 --- a/demo/collections/Localized.ts +++ b/demo/collections/Localized.ts @@ -98,6 +98,11 @@ const LocalizedPosts: CollectionConfig = { name: 'text', label: 'Text', }, + { + type: 'text', + name: 'demoHiddenField', + hidden: true, + }, ], }, { diff --git a/src/collections/operations/local/local.spec.js b/src/collections/operations/local/local.spec.js index 44c77adcdc..6d9ad92899 100644 --- a/src/collections/operations/local/local.spec.js +++ b/src/collections/operations/local/local.spec.js @@ -51,4 +51,39 @@ describe('Collections - Local', () => { expect(result.width).toStrictEqual(640); }); }); + + describe('Read with Hidden Fields', () => { + it('should allow a document with nested hidden fields to be retrieved with hidden fields shown.', async () => { + const demoHiddenField = 'this is going to be hidden'; + + const result = await payload.create({ + collection: 'localized-posts', + data: { + title: 'this post has a hidden field present', + description: 'desc', + priority: 1, + nonLocalizedGroup: { + text: '40w5g534gw34j', + }, + localizedGroup: { + text: '34lijgw45ligjw4li5j', + demoHiddenField, + }, + }, + }); + + expect(result.id).toBeDefined(); + expect(result.localizedGroup).toBeDefined(); + expect(result.localizedGroup.demoHiddenField).toBeUndefined(); + + const withHiddenFields = await payload.findByID({ + collection: 'localized-posts', + id: result.id, + showHiddenFields: true, + }); + + expect(withHiddenFields.localizedGroup.demoHiddenField).toStrictEqual(demoHiddenField); + expect(withHiddenFields.id).toStrictEqual(result.id); + }); + }); }); diff --git a/src/fields/traverseFields.ts b/src/fields/traverseFields.ts index 587cd39dd1..1ab4ed6fb6 100644 --- a/src/fields/traverseFields.ts +++ b/src/fields/traverseFields.ts @@ -252,6 +252,7 @@ const traverseFields = (args: Arguments): void => { docWithLocales: docWithLocales?.[field.name]?.[i], path: `${path}${field.name}.${i}.`, skipValidation: skipValidationFromHere, + showHiddenFields, }); } } @@ -264,6 +265,7 @@ const traverseFields = (args: Arguments): void => { docWithLocales: docWithLocales?.[field.name], path: `${path}${field.name}.`, skipValidation: skipValidationFromHere, + showHiddenFields, }); } } @@ -282,6 +284,7 @@ const traverseFields = (args: Arguments): void => { docWithLocales: docWithLocales?.[field.name]?.[i], path: `${path}${field.name}.${i}.`, skipValidation: skipValidationFromHere, + showHiddenFields, }); } }); From 2e6af975063c8e1a840cfb3f075921d1e0578466 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Dec 2021 15:51:47 -0500 Subject: [PATCH 09/11] chore: beta release --- CHANGELOG.md | 115 +-------------------------------------------------- package.json | 2 +- 2 files changed, 3 insertions(+), 114 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 822ede0f16..34c914b18f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## [0.13.18-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.18-beta.0) (2021-12-29) +## [0.13.19-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.19-beta.0) (2021-12-29) ### Bug Fixes @@ -6,6 +6,7 @@ * [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) * [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) * [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) +* [#408](https://github.com/payloadcms/payload/issues/408) ([e2c5d93](https://github.com/payloadcms/payload/commit/e2c5d93751cb1902d6dce2147953b97c2dc17939)) * 407 ([a09570c](https://github.com/payloadcms/payload/commit/a09570c78dc923f3553f36d726e5cfac925290a0)) * allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) * cross-browser upload drag and drop ([4119eec](https://github.com/payloadcms/payload/commit/4119eec796794d6a026f34f8b097b379eb9895a0)) @@ -16,118 +17,6 @@ * globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade)) -### Features - -* builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b)) -* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7)) -* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b)) - -## [0.13.17-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.17-beta.0) (2021-12-29) - - -### Bug Fixes - -* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) -* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) -* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) -* 407 ([a09570c](https://github.com/payloadcms/payload/commit/a09570c78dc923f3553f36d726e5cfac925290a0)) -* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) -* cross-browser upload drag and drop ([4119eec](https://github.com/payloadcms/payload/commit/4119eec796794d6a026f34f8b097b379eb9895a0)) -* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4)) -* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3)) -* ensures row count is set properly in block fields ([9e091af](https://github.com/payloadcms/payload/commit/9e091af67e944e6a15d1d1174a18cde6deda40d7)) -* ensures searching relationships works with many pages of results ([961787d](https://github.com/payloadcms/payload/commit/961787d681882e5ab48bb676490555c93f5d4a2e)) -* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade)) - - -### Features - -* builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b)) -* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7)) -* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b)) - -## [0.13.16-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.16-beta.0) (2021-12-29) - - -### Bug Fixes - -* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) -* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) -* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) -* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) -* cross-browser upload drag and drop ([4119eec](https://github.com/payloadcms/payload/commit/4119eec796794d6a026f34f8b097b379eb9895a0)) -* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4)) -* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3)) -* ensures row count is set properly in block fields ([9e091af](https://github.com/payloadcms/payload/commit/9e091af67e944e6a15d1d1174a18cde6deda40d7)) -* ensures searching relationships works with many pages of results ([961787d](https://github.com/payloadcms/payload/commit/961787d681882e5ab48bb676490555c93f5d4a2e)) -* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade)) - - -### Features - -* builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b)) -* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7)) -* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b)) - -## [0.13.15-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.15-beta.0) (2021-12-29) - - -### Bug Fixes - -* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) -* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) -* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) -* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) -* cross-browser upload drag and drop ([4119eec](https://github.com/payloadcms/payload/commit/4119eec796794d6a026f34f8b097b379eb9895a0)) -* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4)) -* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3)) -* ensures row count is set properly in block fields ([9e091af](https://github.com/payloadcms/payload/commit/9e091af67e944e6a15d1d1174a18cde6deda40d7)) -* ensures searching relationships works with many pages of results ([961787d](https://github.com/payloadcms/payload/commit/961787d681882e5ab48bb676490555c93f5d4a2e)) -* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade)) - - -### Features - -* builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b)) -* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7)) -* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b)) - -## [0.13.14-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.14-beta.0) (2021-12-29) - - -### Bug Fixes - -* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) -* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) -* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) -* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) -* cross-browser upload drag and drop ([4119eec](https://github.com/payloadcms/payload/commit/4119eec796794d6a026f34f8b097b379eb9895a0)) -* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4)) -* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3)) -* ensures row count is set properly in block fields ([9e091af](https://github.com/payloadcms/payload/commit/9e091af67e944e6a15d1d1174a18cde6deda40d7)) -* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade)) - - -### Features - -* builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b)) -* exports custom text and select inputs ([52edb5b](https://github.com/payloadcms/payload/commit/52edb5b77f45e267c43a284c5591044ac4d726e7)) -* exposes default Dashboard and Nav components for re-import ([ffe8e17](https://github.com/payloadcms/payload/commit/ffe8e17ac06c2fc89c3c51cab545df9756d3910b)) - -## [0.13.13-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.13-beta.0) (2021-12-28) - - -### Bug Fixes - -* [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) -* [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) -* [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) -* allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) -* ensures getDataByPath works ([140a3aa](https://github.com/payloadcms/payload/commit/140a3aa9eafa29b2a43bdfd8883c79c6ee4a93e4)) -* ensures local findByID retains user ([05288ee](https://github.com/payloadcms/payload/commit/05288ee08c077019e4432bf385aeacc23a0643f3)) -* globals model typing ([da7c0c9](https://github.com/payloadcms/payload/commit/da7c0c984c1fb57038d620fc59bcd27972919ade)) - - ### Features * builds custom routes API, Before/After Dashboard and Nav custom components ([e337c62](https://github.com/payloadcms/payload/commit/e337c62ba179821c994404a2b693871b2401861b)) diff --git a/package.json b/package.json index abedcff11a..41f535b287 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "0.13.18-beta.0", + "version": "0.13.19-beta.0", "description": "Node, React and MongoDB Headless CMS and Application Framework", "license": "SEE LICENSE IN license.md", "author": { From 5c3cfa4c93767a5ead9e816bf11a000ebdac9761 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Dec 2021 16:08:08 -0500 Subject: [PATCH 10/11] fix: #408 --- demo/collections/RelationshipA.ts | 5 +++ .../operations/local/local.spec.js | 32 +++++++++++++++++++ src/fields/accessPromise.ts | 4 ++- src/fields/relationshipPopulationPromise.ts | 7 ++++ src/fields/richTextRelationshipPromise.ts | 9 ++++++ src/fields/traverseFields.ts | 2 ++ src/graphql/schema/buildObjectType.ts | 1 + 7 files changed, 59 insertions(+), 1 deletion(-) diff --git a/demo/collections/RelationshipA.ts b/demo/collections/RelationshipA.ts index 4c288fbb11..ba78729223 100644 --- a/demo/collections/RelationshipA.ts +++ b/demo/collections/RelationshipA.ts @@ -56,6 +56,11 @@ const RelationshipA: CollectionConfig = { hasMany: true, localized: true, }, + { + name: 'demoHiddenField', + type: 'text', + hidden: true, + }, ], timestamps: true, }; diff --git a/src/collections/operations/local/local.spec.js b/src/collections/operations/local/local.spec.js index 6d9ad92899..b08b793df8 100644 --- a/src/collections/operations/local/local.spec.js +++ b/src/collections/operations/local/local.spec.js @@ -85,5 +85,37 @@ describe('Collections - Local', () => { expect(withHiddenFields.localizedGroup.demoHiddenField).toStrictEqual(demoHiddenField); expect(withHiddenFields.id).toStrictEqual(result.id); }); + + it('should allow a document with a relationship to a document with hidden fields to read the related document hidden fields', async () => { + const demoHiddenField = 'this is going to be hidden'; + + const relationshipA = await payload.create({ + collection: 'relationship-a', + data: { + demoHiddenField, + }, + }); + + expect(relationshipA.id).toBeDefined(); + expect(relationshipA.demoHiddenField).toBeUndefined(); + + const relationshipB = await payload.create({ + collection: 'relationship-b', + data: { + title: 'pretty clever name here', + post: [relationshipA.id], + }, + }); + + expect(relationshipB.id).toBeDefined(); + + const relationshipBWithHiddenNestedField = await payload.findByID({ + collection: 'relationship-b', + id: relationshipB.id, + showHiddenFields: true, + }); + + expect(relationshipBWithHiddenNestedField.post[0].demoHiddenField).toStrictEqual(demoHiddenField); + }); }); }); diff --git a/src/fields/accessPromise.ts b/src/fields/accessPromise.ts index 93df803979..1d3968d9fc 100644 --- a/src/fields/accessPromise.ts +++ b/src/fields/accessPromise.ts @@ -18,12 +18,12 @@ type Arguments = { currentDepth: number hook: HookName payload: Payload + showHiddenFields: boolean } const accessPromise = async ({ data, fullData, - originalDoc, field, operation, overrideAccess, @@ -34,6 +34,7 @@ const accessPromise = async ({ currentDepth, hook, payload, + showHiddenFields, }: Arguments): Promise => { const resultingData = data; @@ -56,6 +57,7 @@ const accessPromise = async ({ if ((field.type === 'relationship' || field.type === 'upload') && hook === 'afterRead') { relationshipPopulations.push(relationshipPopulationPromise({ + showHiddenFields, data, field, depth, diff --git a/src/fields/relationshipPopulationPromise.ts b/src/fields/relationshipPopulationPromise.ts index 359a462618..9909224ed3 100644 --- a/src/fields/relationshipPopulationPromise.ts +++ b/src/fields/relationshipPopulationPromise.ts @@ -12,6 +12,7 @@ type PopulateArgs = { field: RelationshipField | UploadField index?: number payload: Payload + showHiddenFields: boolean } const populate = async ({ @@ -24,6 +25,7 @@ const populate = async ({ field, index, payload, + showHiddenFields, }: PopulateArgs) => { const dataToUpdate = dataReference; @@ -48,6 +50,7 @@ const populate = async ({ overrideAccess, disableErrors: true, depth, + showHiddenFields, }); } @@ -76,6 +79,7 @@ type PromiseArgs = { req: PayloadRequest overrideAccess: boolean payload: Payload + showHiddenFields: boolean } const relationshipPopulationPromise = ({ @@ -86,6 +90,7 @@ const relationshipPopulationPromise = ({ req, overrideAccess, payload, + showHiddenFields, }: PromiseArgs) => async (): Promise => { const resultingData = data; const populateDepth = fieldHasMaxDepth(field) && field.maxDepth < depth ? field.maxDepth : depth; @@ -106,6 +111,7 @@ const relationshipPopulationPromise = ({ field, index, payload, + showHiddenFields, }); } }; @@ -124,6 +130,7 @@ const relationshipPopulationPromise = ({ data: data[field.name], field, payload, + showHiddenFields, }); } }; diff --git a/src/fields/richTextRelationshipPromise.ts b/src/fields/richTextRelationshipPromise.ts index b6c816554a..e148a3cc42 100644 --- a/src/fields/richTextRelationshipPromise.ts +++ b/src/fields/richTextRelationshipPromise.ts @@ -11,6 +11,7 @@ type Arguments = { payload: Payload field: RichTextField req: PayloadRequest + showHiddenFields: boolean } type RecurseRichTextArgs = { @@ -22,6 +23,7 @@ type RecurseRichTextArgs = { field: RichTextField req: PayloadRequest promises: Promise[] + showHiddenFields: boolean } const populate = async ({ @@ -33,6 +35,7 @@ const populate = async ({ currentDepth, payload, req, + showHiddenFields, }: Arguments & { id: string, collection: Collection @@ -50,6 +53,7 @@ const populate = async ({ overrideAccess, disableErrors: true, depth, + showHiddenFields, }); if (doc) { @@ -68,6 +72,7 @@ const recurseRichText = ({ currentDepth = 0, field, promises, + showHiddenFields, }: RecurseRichTextArgs) => { if (Array.isArray(children)) { (children as any[]).forEach((element) => { @@ -87,6 +92,7 @@ const recurseRichText = ({ payload, field, collection, + showHiddenFields, })); } @@ -100,6 +106,7 @@ const recurseRichText = ({ currentDepth, field, promises, + showHiddenFields, }); } }); @@ -114,6 +121,7 @@ const richTextRelationshipPromise = ({ depth, currentDepth, field, + showHiddenFields, }: Arguments) => async (): Promise => { const promises = []; @@ -126,6 +134,7 @@ const richTextRelationshipPromise = ({ currentDepth, field, promises, + showHiddenFields, }); await Promise.all(promises); diff --git a/src/fields/traverseFields.ts b/src/fields/traverseFields.ts index 1ab4ed6fb6..6fd7171fec 100644 --- a/src/fields/traverseFields.ts +++ b/src/fields/traverseFields.ts @@ -147,6 +147,7 @@ const traverseFields = (args: Arguments): void => { depth, field, currentDepth, + showHiddenFields, })); } } @@ -213,6 +214,7 @@ const traverseFields = (args: Arguments): void => { currentDepth, hook, payload, + showHiddenFields, })); hookPromises.push(() => hookPromise({ diff --git a/src/graphql/schema/buildObjectType.ts b/src/graphql/schema/buildObjectType.ts index 7483113847..1d22be100c 100644 --- a/src/graphql/schema/buildObjectType.ts +++ b/src/graphql/schema/buildObjectType.ts @@ -55,6 +55,7 @@ function buildObjectType(name: string, fields: Field[], parentName: string, base payload: context.req.payload, depth: args.depth, field, + showHiddenFields: false, }); await richTextRelationshipPromise(); From 932116e953a764f265c44e36ce83ce4bde491929 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 29 Dec 2021 16:10:15 -0500 Subject: [PATCH 11/11] chore: beta release --- CHANGELOG.md | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34c914b18f..c095553068 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## [0.13.19-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.19-beta.0) (2021-12-29) +## [0.13.20-beta.0](https://github.com/payloadcms/payload/compare/v0.13.6...v0.13.20-beta.0) (2021-12-29) ### Bug Fixes @@ -6,6 +6,7 @@ * [#370](https://github.com/payloadcms/payload/issues/370), only performs password functions when auth enabled ([9738873](https://github.com/payloadcms/payload/commit/97388738def687f3b26eaf8de6b067f4d3758418)) * [#390](https://github.com/payloadcms/payload/issues/390), safari rich text link bug ([a16b99b](https://github.com/payloadcms/payload/commit/a16b99b0c87d55f768ed74ab35708a291fc7bbb0)) * [#393](https://github.com/payloadcms/payload/issues/393), ensures preview button gets up to date data ([2f47e39](https://github.com/payloadcms/payload/commit/2f47e39a9f765bd8ce437d4b7500a5b314a192a5)) +* [#408](https://github.com/payloadcms/payload/issues/408) ([5c3cfa4](https://github.com/payloadcms/payload/commit/5c3cfa4c93767a5ead9e816bf11a000ebdac9761)) * [#408](https://github.com/payloadcms/payload/issues/408) ([e2c5d93](https://github.com/payloadcms/payload/commit/e2c5d93751cb1902d6dce2147953b97c2dc17939)) * 407 ([a09570c](https://github.com/payloadcms/payload/commit/a09570c78dc923f3553f36d726e5cfac925290a0)) * allows null in ImageSize width and height types ([ba79fd4](https://github.com/payloadcms/payload/commit/ba79fd42dbf20ba712a0632da9193fcc516c0257)) diff --git a/package.json b/package.json index 41f535b287..1ab640e1ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "payload", - "version": "0.13.19-beta.0", + "version": "0.13.20-beta.0", "description": "Node, React and MongoDB Headless CMS and Application Framework", "license": "SEE LICENSE IN license.md", "author": {