Skip to content

Commit 39a6bbb

Browse files
fix: Eliminates next stage view rendered with multistep component (#511)
Co-authored-by: tumms2021389 <[email protected]>
1 parent c4d60d8 commit 39a6bbb

File tree

1 file changed

+31
-24
lines changed
  • packages/react-sdk-components/src/components/infra/Assignment

1 file changed

+31
-24
lines changed

packages/react-sdk-components/src/components/infra/Assignment/Assignment.tsx

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -97,37 +97,44 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
9797
const oWorkItem = firstChild.props.getPConnect();
9898
const oWorkData = oWorkItem.getDataObject();
9999
const oData: any = thePConn.getDataObject(''); // 1st arg empty string until typedefs allow it to be optional
100+
const caseInfo = oData?.caseInfo;
101+
if (!oWorkData?.caseInfo || oWorkData.caseInfo.assignments === null || !caseInfo) {
102+
return;
103+
}
100104

101-
if (oWorkData?.caseInfo && oWorkData.caseInfo.assignments !== null) {
102-
const oCaseInfo = oData?.caseInfo;
105+
// Set action buttons
106+
if (caseInfo.actionButtons) {
107+
setActionButtons(caseInfo.actionButtons);
108+
}
103109

104-
if (oCaseInfo && oCaseInfo.actionButtons) {
105-
setActionButtons(oCaseInfo.actionButtons);
106-
}
110+
// Handle navigation setup
111+
const navigation = caseInfo.navigation;
112+
if (!navigation) {
113+
setHasNavigation(false);
114+
return;
115+
}
107116

108-
if (oCaseInfo?.navigation /* was oCaseInfo.navigation != null */) {
109-
setHasNavigation(true);
117+
const isStandardTemplate = navigation.template?.toLowerCase() === 'standard';
118+
const hasSingleStep = navigation.steps?.length === 1;
119+
const shouldHideNavigation = isStandardTemplate || hasSingleStep;
110120

111-
if (
112-
(oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'standard') ||
113-
oCaseInfo?.navigation?.steps?.length === 1
114-
) {
115-
setHasNavigation(false);
116-
} else if (oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === 'vertical') {
117-
setIsVertical(true);
118-
} else {
119-
setIsVertical(false);
120-
}
121+
setHasNavigation(!shouldHideNavigation);
121122

122-
if (oCaseInfo?.navigation?.steps) {
123-
const steps = JSON.parse(JSON.stringify(oCaseInfo?.navigation?.steps));
124-
const formedSteps = getStepsInfo(steps);
125-
setArNavigationSteps(formedSteps);
126-
}
123+
if (shouldHideNavigation) {
124+
return;
125+
}
127126

128-
setArCurrentStepIndicies(findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0));
129-
}
127+
// set vertical navigation
128+
const isVerticalTemplate = navigation.template?.toLowerCase() === 'vertical';
129+
setIsVertical(isVerticalTemplate);
130+
131+
if (navigation.steps) {
132+
const steps = JSON.parse(JSON.stringify(navigation.steps));
133+
const formedSteps = getStepsInfo(steps);
134+
setArNavigationSteps(formedSteps);
130135
}
136+
137+
setArCurrentStepIndicies(findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0));
131138
}
132139
}, [children]);
133140

0 commit comments

Comments
 (0)