@uniformdev/canvas-next-rsc 19.54.2 → 19.54.3-alpha.1
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RouteClient } from '@uniformdev/canvas';
|
|
1
|
+
import { CANVAS_EDITOR_STATE, RouteClient } from '@uniformdev/canvas';
|
|
2
2
|
import { isDevelopmentEnvironment } from '../utils/draft';
|
|
3
3
|
import { buildPathTag } from '../utils/tag';
|
|
4
4
|
export const getRouteClient = (options) => {
|
|
@@ -18,10 +18,13 @@ export const getRouteClient = (options) => {
|
|
|
18
18
|
requestedUrl = new URL(req.url);
|
|
19
19
|
}
|
|
20
20
|
const tags = [];
|
|
21
|
+
let state;
|
|
21
22
|
if (requestedUrl) {
|
|
22
23
|
// this is here so this code breaks if parameters change here
|
|
23
24
|
const pathKey = 'path';
|
|
25
|
+
const stateKey = 'state';
|
|
24
26
|
const path = requestedUrl.searchParams.get(pathKey);
|
|
27
|
+
state = parseInt(requestedUrl.searchParams.get(stateKey) || '', 10);
|
|
25
28
|
if (path) {
|
|
26
29
|
// at this point, we do not know if this path is dynamic or not
|
|
27
30
|
// so apply each segment as a tag so we can clear any segment, ie:
|
|
@@ -43,6 +46,10 @@ export const getRouteClient = (options) => {
|
|
|
43
46
|
noCache = true;
|
|
44
47
|
revalidate = undefined;
|
|
45
48
|
}
|
|
49
|
+
const extraHeaders = {};
|
|
50
|
+
if (state === CANVAS_EDITOR_STATE) {
|
|
51
|
+
extraHeaders['x-bypass-cache'] = 'true';
|
|
52
|
+
}
|
|
46
53
|
return fetch(req, {
|
|
47
54
|
...init,
|
|
48
55
|
cache: noCache ? 'no-cache' : 'force-cache',
|
|
@@ -50,6 +57,10 @@ export const getRouteClient = (options) => {
|
|
|
50
57
|
revalidate,
|
|
51
58
|
tags: tags.length ? tags : undefined,
|
|
52
59
|
},
|
|
60
|
+
headers: {
|
|
61
|
+
...((init === null || init === void 0 ? void 0 : init.headers) || {}),
|
|
62
|
+
...extraHeaders,
|
|
63
|
+
},
|
|
53
64
|
});
|
|
54
65
|
},
|
|
55
66
|
});
|
|
@@ -8,6 +8,8 @@ export type CompositionContext = Omit<RouteGetResponseComposition, 'compositionA
|
|
|
8
8
|
[key: string]: string | undefined;
|
|
9
9
|
} | undefined;
|
|
10
10
|
cookieValue: string | undefined;
|
|
11
|
+
isDraftMode: boolean;
|
|
12
|
+
isContextualEditing: boolean;
|
|
11
13
|
};
|
|
12
14
|
export type ComponentProps<TProps = unknown> = TProps & {
|
|
13
15
|
component: ComponentInstance;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense } from 'react';
|
|
3
|
+
import { isDraftModeEnabled, isIncontextEditingEnabled } from '../utils/draft';
|
|
3
4
|
import { resolveComposition } from './retrieveRoute';
|
|
4
5
|
import { UniformComponent } from './UniformComponent';
|
|
5
6
|
import { UniformProvider } from './UniformContext';
|
|
@@ -24,6 +25,10 @@ const UniformCompositionInner = async ({ params, searchParams, update, children,
|
|
|
24
25
|
path,
|
|
25
26
|
searchParams,
|
|
26
27
|
cookieValue,
|
|
28
|
+
isDraftMode: isDraftModeEnabled({ searchParams }),
|
|
29
|
+
isContextualEditing: isIncontextEditingEnabled({
|
|
30
|
+
searchParams,
|
|
31
|
+
}),
|
|
27
32
|
...rest,
|
|
28
33
|
};
|
|
29
34
|
return (_jsxs(UniformProvider, { cookieValue: cookieValue, seenComponents: seenComponents, children: [_jsx(UniformScript, { enabled: isCanvasEditing }), _jsx(UniformComponent, { data: evaluatedComposition, context: context }), Boolean(children) && children] }));
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PureUniformText } from '@uniformdev/canvas-react/core';
|
|
3
|
-
import { isIncontextEditingEnabled } from '../utils/draft';
|
|
4
3
|
export const UniformText = ({ context, ...rest }) => {
|
|
5
|
-
|
|
6
|
-
return _jsx(PureUniformText, { ...rest, isContextualEditing: isEditing, skipCustomRendering: isEditing });
|
|
4
|
+
return (_jsx(PureUniformText, { ...rest, isContextualEditing: context.isContextualEditing, skipCustomRendering: context.isContextualEditing }));
|
|
7
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-next-rsc",
|
|
3
|
-
"version": "19.54.
|
|
3
|
+
"version": "19.54.3-alpha.1+c169f04b0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "tsc --watch",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"react-dom": "18.2.0"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@uniformdev/canvas": "19.54.
|
|
59
|
-
"@uniformdev/canvas-react": "19.54.
|
|
60
|
-
"@uniformdev/context": "19.54.
|
|
61
|
-
"@uniformdev/project-map": "19.54.
|
|
62
|
-
"@uniformdev/redirect": "19.54.
|
|
63
|
-
"@uniformdev/richtext": "19.54.
|
|
64
|
-
"@uniformdev/webhooks": "19.54.
|
|
58
|
+
"@uniformdev/canvas": "19.54.3-alpha.1+c169f04b0",
|
|
59
|
+
"@uniformdev/canvas-react": "19.54.3-alpha.1+c169f04b0",
|
|
60
|
+
"@uniformdev/context": "19.54.3-alpha.1+c169f04b0",
|
|
61
|
+
"@uniformdev/project-map": "19.54.3-alpha.1+c169f04b0",
|
|
62
|
+
"@uniformdev/redirect": "19.54.3-alpha.1+c169f04b0",
|
|
63
|
+
"@uniformdev/richtext": "19.54.3-alpha.1+c169f04b0",
|
|
64
|
+
"@uniformdev/webhooks": "19.54.3-alpha.1+c169f04b0",
|
|
65
65
|
"@vercel/edge-config": "^0.2.0",
|
|
66
66
|
"dequal": "^2.0.3",
|
|
67
67
|
"js-cookie": "^3.0.5",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "c169f04b0eaffb4956c91d3ca0a3ab0c44d64dd4"
|
|
82
82
|
}
|