Refactor code to handle optional properties in GenericNode
This commit is contained in:
parent
fde57a3463
commit
603dba8a4a
1 changed files with 3 additions and 3 deletions
|
|
@ -85,8 +85,8 @@ export default function GenericNode({
|
||||||
// return
|
// return
|
||||||
if (!thisNodeTemplate.code) return;
|
if (!thisNodeTemplate.code) return;
|
||||||
|
|
||||||
const currentCode = thisNodeTemplate.code.value;
|
const currentCode = thisNodeTemplate.code?.value;
|
||||||
const thisNodesCode = data.node!.template.code.value;
|
const thisNodesCode = data.node!.template?.code?.value;
|
||||||
if (currentCode !== thisNodesCode) {
|
if (currentCode !== thisNodesCode) {
|
||||||
addToOutdatedNodes(data.id);
|
addToOutdatedNodes(data.id);
|
||||||
setIsOutdated(true);
|
setIsOutdated(true);
|
||||||
|
|
@ -96,7 +96,7 @@ export default function GenericNode({
|
||||||
setIsOutdated(false);
|
setIsOutdated(false);
|
||||||
}
|
}
|
||||||
// template.code can be undefined
|
// template.code can be undefined
|
||||||
}, [data.node?.template.code.value]);
|
}, [data.node?.template?.code?.value]);
|
||||||
|
|
||||||
const updateNodeCode = useCallback(
|
const updateNodeCode = useCallback(
|
||||||
(newNodeClass: APIClassType, code: string, name: string) => {
|
(newNodeClass: APIClassType, code: string, name: string) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue