Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

fix: OPTIC-353: Fix null errors when switching from task detail to settings #1665

Merged
merged 13 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/LabelStudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export class LabelStudio {
};

const clearRenderedApp = () => {
if (!rootElement.childNodes?.length) return;

const childNodes = [...rootElement.childNodes];
// cleanDomAfterReact needs this key to be sure that cleaning affects only current react subtree
const reactKey = findReactKey(childNodes[0]);
Expand Down
7 changes: 5 additions & 2 deletions src/stores/AppStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -875,12 +875,15 @@ export default types
const children = [];

walk(self, (node) => {
if (!isRoot(node) && getParent(node) === self) children.push(node);
if (!isRoot(node) && getParent(node) === self) {
if (node.annotations) children.unshift(...node.annotations);
else children.push(node);
}
});

let node;

while ((node = children.shift())) {
while ((node = children?.shift())) {
Travis1282 marked this conversation as resolved.
Show resolved Hide resolved
try {
destroy(node);
} catch (e) {
Expand Down
Loading