@pack/react 3.0.2 → 3.0.4
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-sections.d.ts","sourceRoot":"","sources":["../../src/pack/render-sections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAiDlD,UAAU,mBAAmB;IAC3B,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"render-sections.d.ts","sourceRoot":"","sources":["../../src/pack/render-sections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAiDlD,UAAU,mBAAmB;IAC3B,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AA8BD,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,4BAKxD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,mBAAmB,uCAOrD"}
|
|
@@ -37,8 +37,18 @@ function useRenderSections({ content }) {
|
|
|
37
37
|
setLiveContent(content);
|
|
38
38
|
}
|
|
39
39
|
}, [content, isPreview, setLiveContent]);
|
|
40
|
-
//
|
|
41
|
-
|
|
40
|
+
// Smart content selection: prefer current content when it changes (navigation),
|
|
41
|
+
// but allow liveContent to take precedence when it's updated by customizer
|
|
42
|
+
const contentToRender = useMemo(() => {
|
|
43
|
+
// If no liveContent, use current content
|
|
44
|
+
if (!liveContent)
|
|
45
|
+
return content;
|
|
46
|
+
// If content and liveContent are the same page, prefer liveContent (customizer updates)
|
|
47
|
+
if (content?.id === liveContent?.id)
|
|
48
|
+
return liveContent;
|
|
49
|
+
// If they're different pages, prefer current content to prevent stale navigation data
|
|
50
|
+
return content;
|
|
51
|
+
}, [content, liveContent]);
|
|
42
52
|
if (!contentToRender)
|
|
43
53
|
return null;
|
|
44
54
|
return contentToRender?.sections?.nodes || contentToRender?.sections;
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "3.0.
|
|
1
|
+
export const VERSION = "3.0.4";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pack/react",
|
|
3
3
|
"description": "React",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.4",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"engines": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@pack/types": "^0.1.
|
|
25
|
+
"@pack/types": "^0.1.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/react": "^18.2.20",
|