fix(codeTabsComponent): add condition to check if data is truthy before executing code block

fix(codeAreaModal): remove unused isTweakPage variable from useContext
fix(reactflowUtils): remove unnecessary null assertion in unselectAllNodes function
This commit is contained in:
anovazzi1 2023-09-14 19:16:51 -03:00
commit 21827a29ef
4 changed files with 4 additions and 4 deletions

View file

@ -56,7 +56,7 @@ export default function CodeTabsComponent({
}, [flow]); }, [flow]);
useEffect(() => { useEffect(() => {
if (tweaks) { if (tweaks && data) {
unselectAllNodes({ unselectAllNodes({
data, data,
updateNodes: (nodes) => { updateNodes: (nodes) => {

View file

@ -28,7 +28,7 @@ export default function CodeAreaModal({
const { dark } = useContext(darkContext); const { dark } = useContext(darkContext);
const { reactFlowInstance } = useContext(typesContext); const { reactFlowInstance } = useContext(typesContext);
const [height, setHeight] = useState<string | null>(null); const [height, setHeight] = useState<string | null>(null);
const { setErrorData, setSuccessData, isTweakPage } = const { setErrorData, setSuccessData } =
useContext(alertContext); useContext(alertContext);
const [error, setError] = useState<{ const [error, setError] = useState<{
detail: { error: string | undefined; traceback: string | undefined }; detail: { error: string | undefined; traceback: string | undefined };

View file

@ -12,7 +12,7 @@ export type cleanEdgesType = {
export type unselectAllNodesType = { export type unselectAllNodesType = {
updateNodes: (nodes: Node[]) => void; updateNodes: (nodes: Node[]) => void;
data: Node[] | null; data: Node[];
}; };
export type updateEdgesHandleIdsType = { export type updateEdgesHandleIdsType = {

View file

@ -75,7 +75,7 @@ export function cleanEdges({
export function unselectAllNodes({ updateNodes, data }: unselectAllNodesType) { export function unselectAllNodes({ updateNodes, data }: unselectAllNodesType) {
let newNodes = _.cloneDeep(data); let newNodes = _.cloneDeep(data);
newNodes!.forEach((node: Node) => { newNodes.forEach((node: Node) => {
node.selected = false; node.selected = false;
}); });
updateNodes(newNodes!); updateNodes(newNodes!);