Skip to content

Commit

Permalink
fix: initialize selected nodes with tagged nodes in UpdateTagModal (#897
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Aceix authored Nov 12, 2024
1 parent dfcb4b5 commit 0c95a14
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/modals/update-tag-modal/UpdateTagModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { TagsService } from '@/services/TagsService';
import { Network } from '@/models/Network';
import { extractErrorMsg } from '@/utils/ServiceUtils';
import { notification } from 'antd';
import { useCallback, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
import { NULL_NODE } from '@/constants/Types';
import { deduceNodeId } from '@/utils/NodeUtils';
import { useStore } from '@/store/store';
Expand All @@ -46,7 +46,7 @@ export default function UpdateTagModal({ isOpen, tag, nodes, onCancel, onUpdateT
defaultValues: tag,
});

const [selectedNodes, setSelectedNodes] = useState<Node[]>([]);
const [selectedNodes, setSelectedNodes] = useState<Node[]>(tag.tagged_nodes ?? []);

const resetModal = useCallback(() => {
form.reset();
Expand Down Expand Up @@ -166,7 +166,6 @@ export default function UpdateTagModal({ isOpen, tag, nodes, onCancel, onUpdateT
icon: node.is_static ? DocumentIcon : ServerIcon,
}))}
onValueChange={(vals) => {
console.log(vals);
setSelectedNodes(
vals.map(
(val) => nodes.find((node) => node.id === val || node.static_node.clientid === val) ?? NULL_NODE,
Expand Down

0 comments on commit 0c95a14

Please sign in to comment.