Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
refactor(ui): dedupe openSettings palette entry and drop no-op casts
joshistoast83cc945ec98a
diff --git a/invokeai/frontend/webv2/src/workbench/palette/LaunchpadCommandPalette.tsx b/invokeai/frontend/webv2/src/workbench/palette/LaunchpadCommandPalette.tsxindex 30ee752bec..02d22d6486 100644--- a/invokeai/frontend/webv2/src/workbench/palette/LaunchpadCommandPalette.tsx+++ b/invokeai/frontend/webv2/src/workbench/palette/LaunchpadCommandPalette.tsx@@ -1,13 +1,9 @@-import type { WorkbenchPreferences } from '@workbench/settings/contracts';-import { useMountEffect } from '@platform/react/useMountEffect';import { formatHotkeyForPlatform } from '@workbench/hotkeys/keys';import { useWorkbenchPreferences } from '@workbench/settings/store';import { lazy, Suspense } from 'react';import { tinykeys } from 'tinykeys';-import type { SettingsEntryDeps } from './entries';-import { closeCommandPalette, toggleCommandPalette, useIsCommandPaletteOpen } from './paletteStore';import { SETTINGS_ENTRY_DEPS } from './settingsEntryDeps';@@ -31,8 +27,8 @@ export const LaunchpadCommandPalette = () => {<Suspense fallback={null}><LazyLaunchpadCommandPaletteDialogmodifierKeyLabel={formatHotkeyForPlatform('mod')[0]!}- preferences={preferences as WorkbenchPreferences}- settingsEntryDeps={SETTINGS_ENTRY_DEPS as SettingsEntryDeps}+ preferences={preferences}+ settingsEntryDeps={SETTINGS_ENTRY_DEPS}onClose={closeCommandPalette}/></Suspense>diff --git a/invokeai/frontend/webv2/src/workbench/palette/LaunchpadCommandPaletteDialog.tsx b/invokeai/frontend/webv2/src/workbench/palette/LaunchpadCommandPaletteDialog.tsxindex 2469bfa669..6ffc2d866c 100644--- a/invokeai/frontend/webv2/src/workbench/palette/LaunchpadCommandPaletteDialog.tsx+++ b/invokeai/frontend/webv2/src/workbench/palette/LaunchpadCommandPaletteDialog.tsx@@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next';import type { PaletteEntry, SettingsEntryDeps } from './entries';import { CommandPaletteDialog } from './CommandPaletteDialog';-import { buildSettingsEntries } from './entries';+import { buildOpenSettingsEntry, buildSettingsEntries } from './entries';/** Launchpad-only palette adapter: navigation and settings, no editor providers. */const LaunchpadCommandPaletteDialog = ({@@ -49,16 +49,7 @@ const LaunchpadCommandPaletteDialog = ({...(canManageModels ? [navEntry({ id: 'goToModels', run: () => void navigate({ to: '/models' }) })] : []),...(canManageNodes ? [navEntry({ id: 'goToNodes', run: () => void navigate({ to: '/nodes' }) })] : []),...(canManageUsers ? [navEntry({ id: 'goToUsers', run: () => void navigate({ to: '/users' }) })] : []),- {- group: 'App',- groupLabel: t('commandPalette.groups.app'),- id: 'app.openSettings',- isPersistentRecent: true,- keywords: 'preferences options',- run: () => openWorkbenchSettings(),- showInEmptyState: true,- title: t('commandPalette.appEntries.openSettings'),- },+ buildOpenSettingsEntry(t, () => openWorkbenchSettings()),];return [...navigation, ...buildSettingsEntries(preferences, settingsEntryDeps, t)];diff --git a/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPalette.tsx b/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPalette.tsxindex b823e14990..5147cbdadb 100644--- a/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPalette.tsx+++ b/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPalette.tsx@@ -10,8 +10,6 @@ import { openWidgetPlacement } from '@workbench/widgetPlacementCommands';import { getWidgetsForRegion } from '@workbench/widgetRegistry';import { lazy, Suspense } from 'react';-import type { SettingsEntryDeps } from './entries';-import { closeCommandPalette, useIsCommandPaletteOpen } from './paletteStore';import { SETTINGS_ENTRY_DEPS } from './settingsEntryDeps';@@ -38,7 +36,7 @@ const OpenWorkbenchCommandPalette = ({ preferences }: { preferences: WorkbenchPropenWidgetPlacement={openWidgetPlacement}preferences={preferences}requestQueueItemReveal={requestQueueItemReveal}- settingsEntryDeps={SETTINGS_ENTRY_DEPS as SettingsEntryDeps}+ settingsEntryDeps={SETTINGS_ENTRY_DEPS}onClose={closeCommandPalette}/></Suspense>diff --git a/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPaletteDialog.tsx b/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPaletteDialog.tsxindex d1286f4b68..64714f05d2 100644--- a/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPaletteDialog.tsx+++ b/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPaletteDialog.tsx@@ -17,7 +17,7 @@ import { useTranslation } from 'react-i18next';import type { PaletteEntry, PaletteSearchProvider, SettingsEntryDeps } from './entries';import { CommandPaletteDialog } from './CommandPaletteDialog';-import { buildCatalogCommandEntries, buildSettingsEntries } from './entries';+import { buildCatalogCommandEntries, buildOpenSettingsEntry, buildSettingsEntries } from './entries';import { buildExtensionPaletteEntry, createExtensionSearchProvider } from './extensionPaletteAdapters';import { getObjectIdentity } from './objectIdentity';import {@@ -30,16 +30,7 @@ import {} from './paletteProviders';const buildStaticAppEntries = (t: TFunction): PaletteEntry[] => [- {- group: 'App',- groupLabel: t('commandPalette.groups.app'),- id: 'app.openSettings',- isPersistentRecent: true,- keywords: 'preferences options',- run: () => openWorkbenchSettings(),- showInEmptyState: true,- title: t('commandPalette.appEntries.openSettings'),- },+ buildOpenSettingsEntry(t, () => openWorkbenchSettings()),{group: 'App',groupLabel: t('commandPalette.groups.app'),diff --git a/invokeai/frontend/webv2/src/workbench/palette/entries.ts b/invokeai/frontend/webv2/src/workbench/palette/entries.tsindex b56b239a7a..76ba6dd6d5 100644--- a/invokeai/frontend/webv2/src/workbench/palette/entries.ts+++ b/invokeai/frontend/webv2/src/workbench/palette/entries.ts@@ -309,6 +309,18 @@ export interface SettingsEntryDeps {themes: ReadonlyArray<{ id: WorkbenchPreferences['themeId']; label: string }>;}+/** The "Open Settings" entry shared verbatim by both palette hosts. */+export const buildOpenSettingsEntry = (t: TFunction, openSettings: () => void): PaletteEntry => ({+ group: 'App',+ groupLabel: t('commandPalette.groups.app'),+ id: 'app.openSettings',+ isPersistentRecent: true,+ keywords: 'preferences options',+ run: openSettings,+ showInEmptyState: true,+ title: t('commandPalette.appEntries.openSettings'),+});+export const buildSettingsEntries = (preferences: WorkbenchPreferences,deps: SettingsEntryDeps,