@dotcms/client 1.5.5-next.2290 → 1.5.5-next.2293
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.
- package/index.cjs.js +3 -1
- package/index.esm.js +3 -1
- package/internal.cjs.js +8 -4
- package/internal.esm.js +8 -4
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -2542,7 +2542,9 @@ class PageClient extends BaseApiClient {
|
|
|
2542
2542
|
query: completeQuery,
|
|
2543
2543
|
variables: requestVariables
|
|
2544
2544
|
},
|
|
2545
|
-
|
|
2545
|
+
// Always return an array (never `undefined`) so the response stays JSON-serializable
|
|
2546
|
+
// for consumers like Next.js Pages Router (getServerSideProps/getStaticProps throw on undefined).
|
|
2547
|
+
errors: response.errors?.length ? response.errors : [],
|
|
2546
2548
|
...(styleEditorSchemas?.length && { styleEditorSchemas })
|
|
2547
2549
|
};
|
|
2548
2550
|
}
|
package/index.esm.js
CHANGED
|
@@ -2540,7 +2540,9 @@ class PageClient extends BaseApiClient {
|
|
|
2540
2540
|
query: completeQuery,
|
|
2541
2541
|
variables: requestVariables
|
|
2542
2542
|
},
|
|
2543
|
-
|
|
2543
|
+
// Always return an array (never `undefined`) so the response stays JSON-serializable
|
|
2544
|
+
// for consumers like Next.js Pages Router (getServerSideProps/getStaticProps throw on undefined).
|
|
2545
|
+
errors: response.errors?.length ? response.errors : [],
|
|
2544
2546
|
...(styleEditorSchemas?.length && { styleEditorSchemas })
|
|
2545
2547
|
};
|
|
2546
2548
|
}
|
package/internal.cjs.js
CHANGED
|
@@ -19,7 +19,12 @@ const graphqlToPageEntity = (page) => {
|
|
|
19
19
|
}
|
|
20
20
|
const { layout, template, containers, urlContentMap, viewAs, host, vanityUrl, runningExperimentId, numberContents, _map, ...pageAsset } = page;
|
|
21
21
|
const data = (_map || {});
|
|
22
|
-
|
|
22
|
+
// styleEditorSchemas comes back as null from GraphQL outside EDIT_MODE. Separate it from the
|
|
23
|
+
// rest of the page fields so it can be omitted entirely when it has no value. Emitting
|
|
24
|
+
// `undefined` (the previous behaviour) breaks JSON serialization for consumers like Next.js
|
|
25
|
+
// Pages Router (getServerSideProps/getStaticProps), while omitting the key keeps the optional
|
|
26
|
+
// DotCMSPage.styleEditorSchemas type accurate.
|
|
27
|
+
const { styleEditorSchemas, ...typedPageAsset } = pageAsset;
|
|
23
28
|
// Merge all urlContentMap keys into _map, except _map itself
|
|
24
29
|
const mergedUrlContentMap = {
|
|
25
30
|
...(urlContentMap?._map || {}),
|
|
@@ -43,9 +48,8 @@ const graphqlToPageEntity = (page) => {
|
|
|
43
48
|
page: {
|
|
44
49
|
...data,
|
|
45
50
|
...typedPageAsset,
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
styleEditorSchemas: typedPageAsset.styleEditorSchemas ?? undefined
|
|
51
|
+
// Only re-add styleEditorSchemas when it actually has a value (see destructure above).
|
|
52
|
+
...(styleEditorSchemas ? { styleEditorSchemas } : {})
|
|
49
53
|
}
|
|
50
54
|
};
|
|
51
55
|
};
|
package/internal.esm.js
CHANGED
|
@@ -17,7 +17,12 @@ const graphqlToPageEntity = (page) => {
|
|
|
17
17
|
}
|
|
18
18
|
const { layout, template, containers, urlContentMap, viewAs, host, vanityUrl, runningExperimentId, numberContents, _map, ...pageAsset } = page;
|
|
19
19
|
const data = (_map || {});
|
|
20
|
-
|
|
20
|
+
// styleEditorSchemas comes back as null from GraphQL outside EDIT_MODE. Separate it from the
|
|
21
|
+
// rest of the page fields so it can be omitted entirely when it has no value. Emitting
|
|
22
|
+
// `undefined` (the previous behaviour) breaks JSON serialization for consumers like Next.js
|
|
23
|
+
// Pages Router (getServerSideProps/getStaticProps), while omitting the key keeps the optional
|
|
24
|
+
// DotCMSPage.styleEditorSchemas type accurate.
|
|
25
|
+
const { styleEditorSchemas, ...typedPageAsset } = pageAsset;
|
|
21
26
|
// Merge all urlContentMap keys into _map, except _map itself
|
|
22
27
|
const mergedUrlContentMap = {
|
|
23
28
|
...(urlContentMap?._map || {}),
|
|
@@ -41,9 +46,8 @@ const graphqlToPageEntity = (page) => {
|
|
|
41
46
|
page: {
|
|
42
47
|
...data,
|
|
43
48
|
...typedPageAsset,
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
styleEditorSchemas: typedPageAsset.styleEditorSchemas ?? undefined
|
|
49
|
+
// Only re-add styleEditorSchemas when it actually has a value (see destructure above).
|
|
50
|
+
...(styleEditorSchemas ? { styleEditorSchemas } : {})
|
|
47
51
|
}
|
|
48
52
|
};
|
|
49
53
|
};
|