Skip to content

Commit

Permalink
TasksPage: update documentation for updateNextStepForStep
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunanoordin committed Jan 24, 2025
1 parent 9445528 commit ac0d0ce
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/pages/lab-pages-editor/components/TasksPage/TasksPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,13 @@ export default function TasksPage() {
setActiveStepIndex(-1);
}

// Changes the optional "next page" of a step/page
/*
Changes the optional "next page" of a step/page
- stepKey must be a key/id that matches an item in workflow.steps
- next must be EITHER undefined OR another step key.
TODO: document what it means when 'next' is undefined.
*/
function updateNextStepForStep(stepKey, next = undefined) {
if (!workflow || !workflow.steps) return;

Expand All @@ -231,6 +237,9 @@ export default function TasksPage() {
const stepBody = workflow.steps[stepIndex]?.[1];
if (!stepBody) return;

// TODO: check if 'next' is either undefined, or a valid step key.
// TODO: if (stepKey && stepKey === next), return. (This is invalid)

const newSteps = workflow.steps.slice();
newSteps[stepIndex] = [stepKey, { ...stepBody, next }];

Expand Down

0 comments on commit ac0d0ce

Please sign in to comment.