fix(lint): remove unused snmpDiscoverResult, fix useCallback deps
- Remove unused snmpDiscoverResult state and ProfileTestResponse import - Wrap handleDeviceClick in useCallback, add to Enter shortcut deps Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
||||
vpnApi,
|
||||
credentialProfilesApi,
|
||||
type CredentialProfileResponse,
|
||||
type ProfileTestResponse,
|
||||
} from '@/lib/api'
|
||||
import { toast } from '@/components/ui/toast'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -58,8 +57,6 @@ export function AddDeviceForm({ tenantId, open, onClose }: Props) {
|
||||
const [showSnmpBulk, setShowSnmpBulk] = useState(false)
|
||||
const [snmpIp, setSnmpIp] = useState('')
|
||||
const [snmpCredProfileId, setSnmpCredProfileId] = useState('')
|
||||
const [snmpDiscoverResult, setSnmpDiscoverResult] = useState<ProfileTestResponse | null>(null)
|
||||
|
||||
// Shared state
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [connectionStatus, setConnectionStatus] = useState<ConnectionStatus>('idle')
|
||||
|
||||
@@ -208,12 +208,12 @@ export function FleetTable({
|
||||
updateSearch({ sort_by: col, sort_dir: newDir, page: 1 })
|
||||
}
|
||||
|
||||
const handleDeviceClick = (device: DeviceResponse) => {
|
||||
const handleDeviceClick = useCallback((device: DeviceResponse) => {
|
||||
void navigate({
|
||||
to: '/tenants/$tenantId/devices/$deviceId',
|
||||
params: { tenantId, deviceId: device.id },
|
||||
})
|
||||
}
|
||||
}, [navigate, tenantId])
|
||||
|
||||
const totalPages = data ? Math.ceil(data.total / data.page_size) : 0
|
||||
const startItem = data ? (data.page - 1) * data.page_size + 1 : 0
|
||||
@@ -247,7 +247,7 @@ export function FleetTable({
|
||||
if (selectedIndex >= 0 && selectedIndex < items.length) {
|
||||
handleDeviceClick(items[selectedIndex])
|
||||
}
|
||||
}, [selectedIndex, items]),
|
||||
}, [selectedIndex, items, handleDeviceClick]),
|
||||
hasItems && selectedIndex >= 0,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user