@pega/react-sdk-overrides 0.23.24 → 0.23.25

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.
@@ -30,7 +30,7 @@ const NO_HEADER_TEMPLATES = [
30
30
  ];
31
31
 
32
32
  export default function View(props) {
33
- const { children, template, getPConnect, mode } = props;
33
+ const { children, template, getPConnect, mode, visibility, name: pageName } = props;
34
34
  let { label, showLabel = false } = props;
35
35
 
36
36
  // Get the inherited props from the parent to determine label settings. For 8.6, this is only for embedded data form views
@@ -45,6 +45,13 @@ export default function View(props) {
45
45
  showLabel = true;
46
46
  }
47
47
 
48
+ const key = `${getPConnect().getContextName()}_${getPConnect().getPageReference()}_${pageName}`;
49
+ // As long as the template is defined in the dependencies of the view
50
+ // it will be loaded, otherwise fall back to single column
51
+ if (visibility === false) {
52
+ return '';
53
+ }
54
+
48
55
  // As long as the template is defined in the dependencies of the view
49
56
  // it will be loaded, otherwise fall back to single column
50
57
  // JA - React SDK not using LazyComponentMap yet
@@ -88,7 +95,7 @@ export default function View(props) {
88
95
  // console.log(`View rendering template: ${template}`);
89
96
 
90
97
  // spreading because all props should go to the template
91
- let RenderedTemplate = <ViewTemplate {...props}>{children}</ViewTemplate>;
98
+ let RenderedTemplate = <ViewTemplate key={key} {...props}>{children}</ViewTemplate>;
92
99
 
93
100
  if (FORMTEMPLATES.includes(template) && showLabel) {
94
101
  // Original:
@@ -79,14 +79,17 @@ export default function FieldGroupTemplate(props) {
79
79
 
80
80
  pConn.setInheritedProp('displayMode', 'LABELS_LEFT');
81
81
  const memoisedReadOnlyList = useMemo(() => {
82
- return referenceList.map((item, index) => (
83
- <FieldGroup
84
- key={item[heading]}
85
- name={fieldHeader === 'propertyRef' ? getDynamicHeaderProp(item, index) : `${HEADING} ${index + 1}`}
86
- >
87
- {buildView(pConn, index, lookForChildInConfig)}
88
- </FieldGroup>
89
- ));
82
+ return referenceList.map((item, index) => {
83
+ const key = item[heading] || `field-group-row-${index}`;
84
+ return (
85
+ <FieldGroup
86
+ key={key}
87
+ name={fieldHeader === 'propertyRef' ? getDynamicHeaderProp(item, index) : `${HEADING} ${index + 1}`}
88
+ >
89
+ {buildView(pConn, index, lookForChildInConfig)}
90
+ </FieldGroup>
91
+ );
92
+ });
90
93
  }, []);
91
94
 
92
95
  return <div>{memoisedReadOnlyList}</div>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/react-sdk-overrides",
3
- "version": "0.23.24",
3
+ "version": "0.23.25",
4
4
  "description": "React SDK - Code for overriding components",
5
5
  "_filesComment": "During packing, npm ignores everything NOT in the files list",
6
6
  "files": [