@sitecore-content-sdk/react 2.0.0-canary.4 → 2.0.0-canary.5

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.
@@ -69,7 +69,7 @@ class ErrorBoundaryClass extends react_1.default.Component {
69
69
  return this.isInDevMode() || this.props.page.mode.isEditing || this.props.page.mode.isPreview;
70
70
  }
71
71
  render() {
72
- var _a;
72
+ var _a, _b;
73
73
  if (this.state.error) {
74
74
  if (this.props.errorComponent) {
75
75
  return react_1.default.createElement(this.props.errorComponent, { error: this.state.error });
@@ -92,9 +92,8 @@ class ErrorBoundaryClass extends react_1.default.Component {
92
92
  }
93
93
  }
94
94
  // do not apply suspense when suspense is disabled or when on already dynamic components
95
- if (this.props.disableSuspense || this.props.isDynamic) {
95
+ if (((_b = this.props.disableSuspense) !== null && _b !== void 0 ? _b : true) || this.props.isDynamic)
96
96
  return this.props.children;
97
- }
98
97
  return (react_1.default.createElement(react_1.Suspense, { fallback: react_1.default.createElement("h4", null, this.props.componentLoadingMessage || this.defaultLoadingMessage) }, this.props.children));
99
98
  }
100
99
  }
@@ -49,8 +49,7 @@ const getPlaceholderComponents = (placeholderProps, placeholderRenderings) => {
49
49
  }
50
50
  if (!componentEmpty) {
51
51
  const errorBoundaryKey = rendered.type + '-' + index;
52
- const disableSuspense = placeholderProps.disableSuspense || false;
53
- rendered = (react_1.default.createElement(ErrorBoundary_1.default, { "data-testid": "error-boundary", key: errorBoundaryKey, errorComponent: errorComponent, componentLoadingMessage: componentLoadingMessage, isDynamic: dynamic, disableSuspense: disableSuspense, rendering: rendered.props.rendering }, rendered));
52
+ rendered = (react_1.default.createElement(ErrorBoundary_1.default, { "data-testid": "error-boundary", key: errorBoundaryKey, errorComponent: errorComponent, componentLoadingMessage: componentLoadingMessage, isDynamic: dynamic, disableSuspense: placeholderProps.disableSuspense, rendering: rendered.props.rendering }, rendered));
54
53
  }
55
54
  // if in edit mode then emit shallow chromes for hydration in Pages
56
55
  return isEditing ? (react_1.default.createElement(PlaceholderMetadata_1.PlaceholderMetadata, { key: key, rendering: componentRendering, componentRuntime: componentRuntime }, rendered)) : (rendered);
@@ -32,7 +32,7 @@ class ErrorBoundaryClass extends React.Component {
32
32
  return this.isInDevMode() || this.props.page.mode.isEditing || this.props.page.mode.isPreview;
33
33
  }
34
34
  render() {
35
- var _a;
35
+ var _a, _b;
36
36
  if (this.state.error) {
37
37
  if (this.props.errorComponent) {
38
38
  return React.createElement(this.props.errorComponent, { error: this.state.error });
@@ -55,9 +55,8 @@ class ErrorBoundaryClass extends React.Component {
55
55
  }
56
56
  }
57
57
  // do not apply suspense when suspense is disabled or when on already dynamic components
58
- if (this.props.disableSuspense || this.props.isDynamic) {
58
+ if (((_b = this.props.disableSuspense) !== null && _b !== void 0 ? _b : true) || this.props.isDynamic)
59
59
  return this.props.children;
60
- }
61
60
  return (React.createElement(Suspense, { fallback: React.createElement("h4", null, this.props.componentLoadingMessage || this.defaultLoadingMessage) }, this.props.children));
62
61
  }
63
62
  }
@@ -43,8 +43,7 @@ const getPlaceholderComponents = (placeholderProps, placeholderRenderings) => {
43
43
  }
44
44
  if (!componentEmpty) {
45
45
  const errorBoundaryKey = rendered.type + '-' + index;
46
- const disableSuspense = placeholderProps.disableSuspense || false;
47
- rendered = (React.createElement(ErrorBoundary, { "data-testid": "error-boundary", key: errorBoundaryKey, errorComponent: errorComponent, componentLoadingMessage: componentLoadingMessage, isDynamic: dynamic, disableSuspense: disableSuspense, rendering: rendered.props.rendering }, rendered));
46
+ rendered = (React.createElement(ErrorBoundary, { "data-testid": "error-boundary", key: errorBoundaryKey, errorComponent: errorComponent, componentLoadingMessage: componentLoadingMessage, isDynamic: dynamic, disableSuspense: placeholderProps.disableSuspense, rendering: rendered.props.rendering }, rendered));
48
47
  }
49
48
  // if in edit mode then emit shallow chromes for hydration in Pages
50
49
  return isEditing ? (React.createElement(PlaceholderMetadata, { key: key, rendering: componentRendering, componentRuntime: componentRuntime }, rendered)) : (rendered);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/react",
3
- "version": "2.0.0-canary.4",
3
+ "version": "2.0.0-canary.5",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -76,14 +76,14 @@
76
76
  "react-dom": "^19.2.1"
77
77
  },
78
78
  "dependencies": {
79
- "@sitecore-content-sdk/content": "2.0.0-canary.4",
80
- "@sitecore-content-sdk/core": "2.0.0-canary.4",
81
- "@sitecore-content-sdk/search": "0.2.0-canary.14",
79
+ "@sitecore-content-sdk/content": "2.0.0-canary.5",
80
+ "@sitecore-content-sdk/core": "2.0.0-canary.5",
81
+ "@sitecore-content-sdk/search": "0.2.0-canary.15",
82
82
  "fast-deep-equal": "^3.1.3"
83
83
  },
84
84
  "description": "",
85
85
  "types": "types/index.d.ts",
86
- "gitHead": "5c49b45ca02bc2f418f6018a2221ca69199e21be",
86
+ "gitHead": "8e766814a28a9810c315bf4479496c4f7f1ace0e",
87
87
  "files": [
88
88
  "dist",
89
89
  "types",
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,KAAK,mBAAmB,GAAG;IACzB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,GAA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C3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,OACI;IAAE,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,GAC9C;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,sBAOnD,CAAC;AAwEF,QAAA,MAAM,aAAa,GAAI,OAAO,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,sBAI7D,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppPlaceholder.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/AppPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAO/C,OAAO,KAAK,MAAM,OAAO,CAAC;AA6I1B;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,sBAKxD,CAAC"}
1
+ {"version":3,"file":"AppPlaceholder.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/AppPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAO/C,OAAO,KAAK,MAAM,OAAO,CAAC;AA4I1B;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,sBAKxD,CAAC"}
@@ -53,8 +53,11 @@ export interface PlaceholderProps {
53
53
  */
54
54
  componentLoadingMessage?: string;
55
55
  /**
56
- * If true, disables Suspense in ErrorBoundary for the placeholder.
57
- * @default false
56
+ * @deprecated The `disableSuspense` prop is deprecated and will be removed in version 3.0.0.
57
+ * The default value is set to `true` to avoid forcing Suspense usage across all components which could negatively impact performance metrics. Suspense can now be enabled explicitly when needed.
58
+ *
59
+ * If `false`, enables Suspense in ErrorBoundary for the components rendered by placeholder.
60
+ * @default true
58
61
  */
59
62
  disableSuspense?: boolean;
60
63
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,KAAK,mBAAmB,GAAG;IACzB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,SAAS,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC1C;;;OAGG;IACH,MAAM,CAAC,EAAE;QACP,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;KACvC,CAAC;IACF;;;OAGG;IACH,MAAM,CAAC,EAAE;QACP,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;IAEF;;;OAGG;IACH,yBAAyB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;IAE9E;;OAEG;IACH,wBAAwB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;IAE7E;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC;IAC3F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