From ee3dcb49b3050cc1600345d15b1bd3b8f0514401 Mon Sep 17 00:00:00 2001 From: Markus Siering Date: Thu, 20 Aug 2020 14:34:59 +0200 Subject: [PATCH 1/3] fix(addon-docs): correctly sanitize item.type.elements to item.type.value which now only happens if the elements entry is present and also is applied at the correct nesting level of the item object. refs #11944 --- addons/docs/src/lib/docgen/extractDocgenProps.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/docs/src/lib/docgen/extractDocgenProps.ts b/addons/docs/src/lib/docgen/extractDocgenProps.ts index b282526a070..2910a225f8d 100644 --- a/addons/docs/src/lib/docgen/extractDocgenProps.ts +++ b/addons/docs/src/lib/docgen/extractDocgenProps.ts @@ -34,7 +34,16 @@ export const extractComponentSectionArray = (docgenSection: any) => { const createPropDef = getPropDefFactory(typeSystem); return docgenSection.map((item: any) => { - const sanitizedItem = { ...item, value: item.elements }; + let sanitizedItem = item; + if (item.type.elements) { + sanitizedItem = { + ...item, + type: { + ...item.type, + value: item.type.elements, + }, + }; + } return extractProp(sanitizedItem.name, sanitizedItem, typeSystem, createPropDef); }); }; From 7bb60f491135acfd9b743baa40f678996acab7b9 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Thu, 20 Aug 2020 21:26:01 +0800 Subject: [PATCH 2/3] Vue docgen: fix sanitization --- addons/docs/src/lib/docgen/extractDocgenProps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/docs/src/lib/docgen/extractDocgenProps.ts b/addons/docs/src/lib/docgen/extractDocgenProps.ts index 2910a225f8d..98fd5ee55ad 100644 --- a/addons/docs/src/lib/docgen/extractDocgenProps.ts +++ b/addons/docs/src/lib/docgen/extractDocgenProps.ts @@ -35,7 +35,7 @@ export const extractComponentSectionArray = (docgenSection: any) => { return docgenSection.map((item: any) => { let sanitizedItem = item; - if (item.type.elements) { + if (item?.type?.elements) { sanitizedItem = { ...item, type: { From fbd566d12b91d3fff09fa7b2bd5b5bd2ac017e47 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Thu, 20 Aug 2020 22:00:58 +0800 Subject: [PATCH 3/3] Fix deepscan --- addons/docs/src/lib/docgen/extractDocgenProps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/docs/src/lib/docgen/extractDocgenProps.ts b/addons/docs/src/lib/docgen/extractDocgenProps.ts index 98fd5ee55ad..c7a9090adf4 100644 --- a/addons/docs/src/lib/docgen/extractDocgenProps.ts +++ b/addons/docs/src/lib/docgen/extractDocgenProps.ts @@ -35,7 +35,7 @@ export const extractComponentSectionArray = (docgenSection: any) => { return docgenSection.map((item: any) => { let sanitizedItem = item; - if (item?.type?.elements) { + if (item.type?.elements) { sanitizedItem = { ...item, type: {