pass the script element through instead of defaulting to the state to avoid state updates w/ burnettk (#2008)

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
jasquat 2024-07-29 15:48:42 -04:00 committed by GitHub
parent 1129817d6d
commit 70c0d51a0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -527,14 +527,14 @@ export default function ProcessModelEditDiagram() {
};
const setScriptUnitTestElementWithIndex = useCallback(
(scriptIndex: number, element: any = scriptElement) => {
(scriptIndex: number, element: any) => {
const unitTestsModdleElements = getScriptUnitTestElements(element);
if (unitTestsModdleElements.length > 0) {
setCurrentScriptUnitTest(unitTestsModdleElements[scriptIndex]);
setCurrentScriptUnitTestIndex(scriptIndex);
}
},
[scriptElement],
[],
);
const onLaunchScriptEditor = useCallback(
@ -603,7 +603,7 @@ export default function ProcessModelEditDiagram() {
resetUnitTextResult();
const newScriptIndex = currentScriptUnitTestIndex - 1;
if (newScriptIndex >= 0) {
setScriptUnitTestElementWithIndex(newScriptIndex);
setScriptUnitTestElementWithIndex(newScriptIndex, scriptElement);
}
};
@ -612,7 +612,7 @@ export default function ProcessModelEditDiagram() {
const newScriptIndex = currentScriptUnitTestIndex + 1;
const unitTestsModdleElements = getScriptUnitTestElements(scriptElement);
if (newScriptIndex < unitTestsModdleElements.length) {
setScriptUnitTestElementWithIndex(newScriptIndex);
setScriptUnitTestElementWithIndex(newScriptIndex, scriptElement);
}
};