Skip to content

Commit

Permalink
fix: added defensive node removal in creation and grading mode
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-jaeger committed Sep 12, 2024
1 parent 2846483 commit 8a156bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ export class CreationModeSwitch extends React.Component<IModeSwitchProps> {
} else {
currentLayout.widgets.map(w => {
if (w instanceof CreationWidget || w instanceof ErrorWidget) {
currentLayout.removeWidget(w);
try {
currentLayout.removeWidget(w);
} catch(error: any) {
console.log("Could not remove widget: " + w)
console.log("Error: " + error)
}

}
});
}
Expand Down
7 changes: 6 additions & 1 deletion src/components/notebook/manual-grading/grading-switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ export class GradingModeSwitch extends React.Component<IModeSwitchProps> {
} else {
currentLayout.widgets.map(w => {
if (w instanceof DataWidget || w instanceof GradeWidget) {
currentLayout.removeWidget(w);
try {
currentLayout.removeWidget(w);
} catch(error: any) {
console.log("Could not remove widget:" + w)
console.log("Error: " + error)
}
}
});
}
Expand Down

0 comments on commit 8a156bb

Please sign in to comment.