@sitecore-jss/sitecore-jss-react 22.10.0-canary.9 → 22.11.0-canary.2

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.
@@ -93,7 +93,7 @@ class PlaceholderCommon extends react_1.default.Component {
93
93
  const _b = this.props, { name, fields: placeholderFields, params: placeholderParams, missingComponentComponent, hiddenRenderingComponent } = _b, placeholderProps = __rest(_b, ["name", "fields", "params", "missingComponentComponent", "hiddenRenderingComponent"]);
94
94
  const transformedComponents = placeholderData
95
95
  .map((rendering, index) => {
96
- var _a, _b;
96
+ var _a, _b, _c;
97
97
  const key = rendering.uid
98
98
  ? rendering.uid
99
99
  : `component-${index}`;
@@ -150,13 +150,14 @@ class PlaceholderCommon extends react_1.default.Component {
150
150
  const isByocWrapper = componentRendering.componentName === BYOCWrapper_1.BYOC_WRAPPER_RENDERING_NAME;
151
151
  // all dynamic elements will have a separate render prop
152
152
  const isDynamicComponent = !!((_a = component.render) === null || _a === void 0 ? void 0 : _a.preload);
153
- const disableSuspense = this.props.disableSuspense || false;
153
+ const disableSuspense = this.props.disableSuspense ||
154
+ ((_b = this.props.sitecoreContext) === null || _b === void 0 ? void 0 : _b.pageState) === layout_1.LayoutServicePageState.Edit;
154
155
  // wrapping with error boundary could cause problems in case where parent component uses withPlaceholder HOC and tries to access its children props
155
156
  // that's why we need to expose element's props here
156
157
  rendered = (react_1.default.createElement(ErrorBoundary_1.default, Object.assign({ key: rendered.type + '-' + index, errorComponent: this.props.errorComponent, componentLoadingMessage: this.props.componentLoadingMessage, type: type, isDynamic: isDynamicComponent || isByocWrapper, disableSuspense: disableSuspense }, rendered.props), rendered));
157
158
  }
158
159
  // if editMode is equal to 'metadata' then emit shallow chromes for hydration in Pages
159
- if (((_b = this.props.sitecoreContext) === null || _b === void 0 ? void 0 : _b.editMode) === layout_1.EditMode.Metadata) {
160
+ if (((_c = this.props.sitecoreContext) === null || _c === void 0 ? void 0 : _c.editMode) === layout_1.EditMode.Metadata) {
160
161
  return (react_1.default.createElement(PlaceholderMetadata_1.PlaceholderMetadata, { key: key, rendering: rendering }, rendered));
161
162
  }
162
163
  return rendered;
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React from 'react';
13
13
  import { MissingComponent } from './MissingComponent';
14
- import { EditMode, isDynamicPlaceholder, getDynamicPlaceholderPattern, } from '@sitecore-jss/sitecore-jss/layout';
14
+ import { EditMode, isDynamicPlaceholder, getDynamicPlaceholderPattern, LayoutServicePageState, } from '@sitecore-jss/sitecore-jss/layout';
15
15
  import { constants } from '@sitecore-jss/sitecore-jss';
16
16
  import { convertAttributesToReactProps } from '../utils';
17
17
  import { HiddenRendering } from './HiddenRendering';
@@ -87,7 +87,7 @@ export class PlaceholderCommon extends React.Component {
87
87
  const _b = this.props, { name, fields: placeholderFields, params: placeholderParams, missingComponentComponent, hiddenRenderingComponent } = _b, placeholderProps = __rest(_b, ["name", "fields", "params", "missingComponentComponent", "hiddenRenderingComponent"]);
88
88
  const transformedComponents = placeholderData
89
89
  .map((rendering, index) => {
90
- var _a, _b;
90
+ var _a, _b, _c;
91
91
  const key = rendering.uid
92
92
  ? rendering.uid
93
93
  : `component-${index}`;
@@ -144,13 +144,14 @@ export class PlaceholderCommon extends React.Component {
144
144
  const isByocWrapper = componentRendering.componentName === BYOC_WRAPPER_RENDERING_NAME;
145
145
  // all dynamic elements will have a separate render prop
146
146
  const isDynamicComponent = !!((_a = component.render) === null || _a === void 0 ? void 0 : _a.preload);
147
- const disableSuspense = this.props.disableSuspense || false;
147
+ const disableSuspense = this.props.disableSuspense ||
148
+ ((_b = this.props.sitecoreContext) === null || _b === void 0 ? void 0 : _b.pageState) === LayoutServicePageState.Edit;
148
149
  // wrapping with error boundary could cause problems in case where parent component uses withPlaceholder HOC and tries to access its children props
149
150
  // that's why we need to expose element's props here
150
151
  rendered = (React.createElement(ErrorBoundary, Object.assign({ key: rendered.type + '-' + index, errorComponent: this.props.errorComponent, componentLoadingMessage: this.props.componentLoadingMessage, type: type, isDynamic: isDynamicComponent || isByocWrapper, disableSuspense: disableSuspense }, rendered.props), rendered));
151
152
  }
152
153
  // if editMode is equal to 'metadata' then emit shallow chromes for hydration in Pages
153
- if (((_b = this.props.sitecoreContext) === null || _b === void 0 ? void 0 : _b.editMode) === EditMode.Metadata) {
154
+ if (((_c = this.props.sitecoreContext) === null || _c === void 0 ? void 0 : _c.editMode) === EditMode.Metadata) {
154
155
  return (React.createElement(PlaceholderMetadata, { key: key, rendering: rendering }, rendered));
155
156
  }
156
157
  return rendered;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-react",
3
- "version": "22.10.0-canary.9",
3
+ "version": "22.11.0-canary.2",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -61,13 +61,13 @@
61
61
  "react-dom": "^19.1.0"
62
62
  },
63
63
  "dependencies": {
64
- "@sitecore-jss/sitecore-jss": "22.10.0-canary.9",
64
+ "@sitecore-jss/sitecore-jss": "22.11.0-canary.2",
65
65
  "fast-deep-equal": "^3.1.3",
66
66
  "style-attr": "^1.3.0"
67
67
  },
68
68
  "description": "",
69
69
  "types": "types/index.d.ts",
70
- "gitHead": "db2b558f784ce412eacd2f4a26bc0e38f00fe49a",
70
+ "gitHead": "a2f6bec65f2127ae1aed808c999b47977df371d6",
71
71
  "files": [
72
72
  "dist",
73
73
  "types"