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]);
useEffect(() => {
if (tweaks) {
if (tweaks && data) {
unselectAllNodes({
data,
updateNodes: (nodes) => {

View file

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

View file

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

View file

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