diff --git a/frontend/src/components/device-detail/CopyVlanModal.tsx b/frontend/src/components/device-detail/CopyVlanModal.tsx index 4ed1daa..0b70d89 100644 --- a/frontend/src/components/device-detail/CopyVlanModal.tsx +++ b/frontend/src/components/device-detail/CopyVlanModal.tsx @@ -192,7 +192,10 @@ export default function CopyVlanModal({ queryKey: ['ports', deviceId], queryFn: () => devicesApi.getPorts(deviceId).then((r) => r.data), }); - const targetPorts: SwitchPort[] = targetPortsData?.ports ?? []; + const targetPorts = useMemo( + () => targetPortsData?.ports ?? [], + [targetPortsData] + ); const targetBridgeNames = useMemo( () => targetPorts.filter((p) => p.type === 'bridge').map((p) => p.name).sort(naturalSort), @@ -238,13 +241,6 @@ export default function CopyVlanModal({ }); }; - const setPortDirect = (vlanId: number, portName: string, value: PortAssignment) => { - setPortAssignments((prev) => ({ - ...prev, - [vlanId]: { ...(prev[vlanId] ?? {}), [portName]: value }, - })); - }; - const getAssignment = (vlanId: number, portName: string): PortAssignment => portAssignments[vlanId]?.[portName] ?? 'none'; @@ -329,7 +325,7 @@ export default function CopyVlanModal({ const toggleVlan = (vlanId: number) => setSelectedVlanIds((prev) => { const next = new Set(prev); - next.has(vlanId) ? next.delete(vlanId) : next.add(vlanId); + if (next.has(vlanId)) { next.delete(vlanId); } else { next.add(vlanId); } return next; }); @@ -514,7 +510,7 @@ export default function CopyVlanModal({ {op.status === 'identical' && (

- Your port assignment matches what's already on this device — nothing to change. + Your port assignment matches what's already on this device — nothing to change.

)}