From ac0d0ce80ca14bae57e03a4563716bc664b162e7 Mon Sep 17 00:00:00 2001 From: "Shaun A. Noordin" Date: Fri, 24 Jan 2025 19:57:36 +0000 Subject: [PATCH] TasksPage: update documentation for updateNextStepForStep --- .../components/TasksPage/TasksPage.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/pages/lab-pages-editor/components/TasksPage/TasksPage.jsx b/app/pages/lab-pages-editor/components/TasksPage/TasksPage.jsx index ef0c2001e9..8c581e9e2d 100644 --- a/app/pages/lab-pages-editor/components/TasksPage/TasksPage.jsx +++ b/app/pages/lab-pages-editor/components/TasksPage/TasksPage.jsx @@ -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; @@ -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 }];