mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fix(desktop): satisfy lint — import order, unused import, exhaustive-deps
- command-center/command-palette/skills: import ordering + drop unused HermesGateway type - settings: wrap openSubView/openProviderView/openKeysView in useCallback so the navGroups memo deps are honest and stable - command-center: add setSection to navGroups memo deps
This commit is contained in:
parent
4acc162712
commit
50d0de0358
4 changed files with 26 additions and 20 deletions
|
|
@ -12,7 +12,6 @@ import type { ActionStatusResponse, AnalyticsResponse, StatusResponse } from '@/
|
|||
import { useI18n } from '@/i18n'
|
||||
import { sessionTitle } from '@/lib/chat-runtime'
|
||||
import { compactNumber } from '@/lib/format'
|
||||
import { useStoreSelector } from '@/lib/use-session-slice'
|
||||
import {
|
||||
Activity,
|
||||
AlertCircle,
|
||||
|
|
@ -26,6 +25,7 @@ import {
|
|||
} from '@/lib/icons'
|
||||
import { exportSession } from '@/lib/session-export'
|
||||
import { fmtDateTime } from '@/lib/time'
|
||||
import { useStoreSelector } from '@/lib/use-session-slice'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { upsertDesktopActionTask } from '@/store/activity'
|
||||
import { $pinnedSessionIds, pinSession, unpinSession } from '@/store/layout'
|
||||
|
|
@ -318,7 +318,7 @@ export function CommandCenterView({ initialSection, onClose, onDeleteSession, on
|
|||
label: cc.sections[value],
|
||||
onSelect: () => setSection(value)
|
||||
})),
|
||||
[cc, section]
|
||||
[cc, section, setSection]
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useStore } from '@nanostores/react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { Dialog as DialogPrimitive } from 'radix-ui'
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, memo } from 'react'
|
||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
import { HUD_HEADING, HUD_ITEM, HUD_POSITION, HUD_SURFACE, HUD_TEXT } from '@/app/floating-hud'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useEffect, useMemo, useRef } from 'react'
|
||||
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
|
||||
import { codiconIcon } from '@/components/ui/codicon'
|
||||
|
|
@ -85,22 +85,29 @@ export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: Set
|
|||
// Jump to a section + its sub-view in one navigate. Two sequential setters
|
||||
// would each read the same stale `search` and the second would clobber the
|
||||
// first's `tab` — so the sub-view never opened on narrow screens.
|
||||
const openSubView = (tab: SettingsViewId, param: string, value: string, fallback: string) => {
|
||||
const params = new URLSearchParams(search)
|
||||
params.set('tab', tab)
|
||||
const openSubView = useCallback(
|
||||
(tab: SettingsViewId, param: string, value: string, fallback: string) => {
|
||||
const params = new URLSearchParams(search)
|
||||
params.set('tab', tab)
|
||||
|
||||
if (value === fallback) {
|
||||
params.delete(param)
|
||||
} else {
|
||||
params.set(param, value)
|
||||
}
|
||||
if (value === fallback) {
|
||||
params.delete(param)
|
||||
} else {
|
||||
params.set(param, value)
|
||||
}
|
||||
|
||||
const qs = params.toString()
|
||||
navigate({ hash, pathname, search: qs ? `?${qs}` : '' }, { replace: true })
|
||||
}
|
||||
const qs = params.toString()
|
||||
navigate({ hash, pathname, search: qs ? `?${qs}` : '' }, { replace: true })
|
||||
},
|
||||
[hash, navigate, pathname, search]
|
||||
)
|
||||
|
||||
const openProviderView = (view: ProviderView) => openSubView('providers', 'pview', view, 'accounts')
|
||||
const openKeysView = (view: KeysView) => openSubView('keys', 'kview', view, 'tools')
|
||||
const openProviderView = useCallback(
|
||||
(view: ProviderView) => openSubView('providers', 'pview', view, 'accounts'),
|
||||
[openSubView]
|
||||
)
|
||||
|
||||
const openKeysView = useCallback((view: KeysView) => openSubView('keys', 'kview', view, 'tools'), [openSubView])
|
||||
|
||||
const importInputRef = useRef<HTMLInputElement | null>(null)
|
||||
|
||||
|
|
@ -251,7 +258,7 @@ export function SettingsView({ onClose, onConfigSaved, onMainModelChanged }: Set
|
|||
onSelect: () => setActiveView('about')
|
||||
}
|
||||
]
|
||||
, [activeView, keysView, providerView, t])
|
||||
, [activeView, keysView, providerView, t, setActiveView, openProviderView, openKeysView])
|
||||
|
||||
const navFooter = (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -16,17 +16,16 @@ import {
|
|||
getSkills,
|
||||
getToolsets,
|
||||
getUsageAnalytics,
|
||||
type HermesGateway,
|
||||
toggleSkill,
|
||||
toggleToolset
|
||||
} from '@/hermes'
|
||||
import { useI18n } from '@/i18n'
|
||||
import { isDesktopToolsetVisible } from '@/lib/desktop-toolsets'
|
||||
import { compactNumber } from '@/lib/format'
|
||||
import { useStoreSelector } from '@/lib/use-session-slice'
|
||||
import { queryClient, writeCache } from '@/lib/query-client'
|
||||
import { invalidateSlashCompletions } from '@/lib/slash-completion-cache'
|
||||
import { normalize } from '@/lib/text'
|
||||
import { useStoreSelector } from '@/lib/use-session-slice'
|
||||
import { $gateway } from '@/store/gateway'
|
||||
import { notify, notifyError } from '@/store/notifications'
|
||||
import { $activeGatewayProfile, normalizeProfileKey } from '@/store/profile'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue