Skip to content

Commit 8802082

Browse files
Merge pull request #103 from pegasystems/bug/tor/BUG-795283
Fixed last view visible at the end of the flow issue
2 parents a881a65 + 696131d commit 8802082

File tree

1 file changed

+65
-64
lines changed
  • packages/react-sdk-components/src/components/infra/Containers/FlowContainer

1 file changed

+65
-64
lines changed

packages/react-sdk-components/src/components/infra/Containers/FlowContainer/FlowContainer.tsx

Lines changed: 65 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import StoreContext from '../../../../bridge/Context/StoreContext';
1515
import DayjsUtils from '@date-io/dayjs';
1616
import { MuiPickersUtilsProvider } from '@material-ui/pickers';
1717

18-
import { addContainerItem, getToDoAssignments } from './helpers';
18+
import { addContainerItem, getToDoAssignments, showBanner } from './helpers';
1919

2020
declare const PCore;
2121

@@ -312,7 +312,6 @@ export default function FlowContainer(props) {
312312
}
313313
}
314314

315-
316315
// if have caseMessage show message and end
317316
const theCaseMessages = thePConn.getValue('caseMessages');
318317

@@ -337,70 +336,70 @@ export default function FlowContainer(props) {
337336
}
338337

339338
// this check in routingInfo, mimic React to check and get the internals of the
340-
// flowContainer and force updates to pConnect/redux
341-
if (routingInfo && loadingInfo !== undefined) {
342-
// debugging/investigation help
343-
// console.log(`${thePConn.getComponentName()}: >>routingInfo: ${JSON.stringify(routingInfo)}`);
344-
345-
const currentOrder = routingInfo.accessedOrder;
346-
const currentItems = routingInfo.items;
347-
const type = routingInfo.type;
348-
if (currentOrder && currentItems) {
349-
// JA - making more similar to React version
350-
const key = currentOrder[currentOrder.length - 1];
351-
352-
// save off itemKey to be used for finishAssignment, etc.
353-
// debugger;
354-
setItemKey(key);
355-
356-
if (
357-
currentOrder.length > 0 &&
358-
currentItems[key] &&
359-
currentItems[key].view &&
360-
type === 'single' &&
361-
!Utils.isEmptyObject(currentItems[key].view)
362-
) {
363-
const currentItem = currentItems[key];
364-
const rootView = currentItem.view;
365-
const { context } = rootView.config;
366-
const config = { meta: rootView };
367-
368-
config['options'] = {
369-
context: currentItem.context,
370-
pageReference: context || localPConn.getPageReference(),
371-
hasForm: true,
372-
isFlowContainer: true,
373-
containerName: localPConn.getContainerName(),
374-
containerItemName: key,
375-
parentPageReference: localPConn.getPageReference()
376-
};
377-
378-
const configObject = PCore.createPConnect(config);
379-
380-
// Since we're setting an array, need to add in an appropriate key
381-
// to remove React warning.
382-
configObject['key'] = config['options'].parentPageReference;
383-
384-
// keep track of these changes
385-
const theNewChildren: Array<Object> = [];
386-
theNewChildren.push(configObject);
387-
setArNewChildren(theNewChildren);
388-
389-
// JEA - adapted from Constellation DX Components FlowContainer since we want to render children that are React components
390-
const root = createElement(createPConnectComponent(), configObject);
391-
setArNewChildrenAsReact([root]);
392-
393-
const oWorkItem = configObject.getPConnect(); // was theNewChildren[0].getPConnect()
394-
const oWorkData = oWorkItem.getDataObject();
395-
396-
// check if have oWorkData, there are times due to timing of state change, when this
397-
// may not be available
398-
if (oWorkData) {
399-
setContainerName(getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name);
400-
}
339+
// flowContainer and force updates to pConnect/redux
340+
if (routingInfo && loadingInfo !== undefined) {
341+
// debugging/investigation help
342+
// console.log(`${thePConn.getComponentName()}: >>routingInfo: ${JSON.stringify(routingInfo)}`);
343+
344+
const currentOrder = routingInfo.accessedOrder;
345+
const currentItems = routingInfo.items;
346+
const type = routingInfo.type;
347+
if (currentOrder && currentItems) {
348+
// JA - making more similar to React version
349+
const key = currentOrder[currentOrder.length - 1];
350+
351+
// save off itemKey to be used for finishAssignment, etc.
352+
// debugger;
353+
setItemKey(key);
354+
355+
if (
356+
currentOrder.length > 0 &&
357+
currentItems[key] &&
358+
currentItems[key].view &&
359+
type === 'single' &&
360+
!Utils.isEmptyObject(currentItems[key].view)
361+
) {
362+
const currentItem = currentItems[key];
363+
const rootView = currentItem.view;
364+
const { context } = rootView.config;
365+
const config = { meta: rootView };
366+
367+
config['options'] = {
368+
context: currentItem.context,
369+
pageReference: context || localPConn.getPageReference(),
370+
hasForm: true,
371+
isFlowContainer: true,
372+
containerName: localPConn.getContainerName(),
373+
containerItemName: key,
374+
parentPageReference: localPConn.getPageReference()
375+
};
376+
377+
const configObject = PCore.createPConnect(config);
378+
379+
// Since we're setting an array, need to add in an appropriate key
380+
// to remove React warning.
381+
configObject['key'] = config['options'].parentPageReference;
382+
383+
// keep track of these changes
384+
const theNewChildren: Array<Object> = [];
385+
theNewChildren.push(configObject);
386+
setArNewChildren(theNewChildren);
387+
388+
// JEA - adapted from Constellation DX Components FlowContainer since we want to render children that are React components
389+
const root = createElement(createPConnectComponent(), configObject);
390+
setArNewChildrenAsReact([root]);
391+
392+
const oWorkItem = configObject.getPConnect(); // was theNewChildren[0].getPConnect()
393+
const oWorkData = oWorkItem.getDataObject();
394+
395+
// check if have oWorkData, there are times due to timing of state change, when this
396+
// may not be available
397+
if (oWorkData) {
398+
setContainerName(getActiveViewLabel() || oWorkData.caseInfo.assignments?.[0].name);
401399
}
402400
}
403401
}
402+
}
404403
}, [props]);
405404

406405
const caseId = thePConn.getCaseSummary().content.pyID;
@@ -413,6 +412,8 @@ export default function FlowContainer(props) {
413412
instructionText = '';
414413
}
415414

415+
const bShowBanner = showBanner(getPConnect);
416+
416417
return (
417418
<div style={{ textAlign: 'left' }} id={buildName} className='psdk-flow-container-top'>
418419
{!bShowConfirm &&
@@ -465,7 +466,7 @@ export default function FlowContainer(props) {
465466
<Alert severity='success'>{caseMessages}</Alert>
466467
</div>
467468
)}
468-
{bShowConfirm && <div>{arNewChildrenAsReact}</div>}
469+
{bShowConfirm && bShowBanner && <div>{arNewChildrenAsReact}</div>}
469470
</div>
470471
);
471472
}

0 commit comments

Comments
 (0)