fix: resolve CI lint errors in CopyVlanModal

- Replace ternary-as-statement with if/else (no-unused-expressions)
- Escape apostrophe in JSX string (react/no-unescaped-entities)
- Wrap targetPorts in useMemo to stabilise useMemo deps
- Remove unused setPortDirect helper
This commit is contained in:
2GT-Rich
2026-05-15 14:47:40 -07:00
parent d3aa72c488
commit 733d16a01f
@@ -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<SwitchPort[]>(
() => 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' && (
<p className="text-xs text-gray-400 dark:text-slate-500">
Your port assignment matches what's already on this device — nothing to change.
Your port assignment matches what&apos;s already on this device — nothing to change.
</p>
)}