Skip to content

Commit 34134f9

Browse files
committed
refactor(modes): hoist ImportModeResult type to module scope
Moves type declaration out of event handler to prevent redeclaration on every message event.
1 parent bce52d6 commit 34134f9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

webview-ui/src/components/modes/ModesView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ const availableGroups = (Object.keys(TOOL_GROUPS) as ToolGroup[]).filter((group)
5555

5656
type ModeSource = "global" | "project"
5757

58+
type ImportModeResult = { type: 'importModeResult'; success: boolean; slug?: string; error?: string }
59+
5860
type ModesViewProps = {
5961
onDone: () => void
6062
}
@@ -478,9 +480,7 @@ const ModesView = ({ onDone }: ModesViewProps) => {
478480
setShowImportDialog(false)
479481

480482
if (message.success) {
481-
// Type safe access to slug
482-
type ImportModeResult = { type: 'importModeResult'; success: boolean; slug?: string; error?: string }
483-
const { slug } = message as ImportModeResult
483+
const { slug } = message as ImportModeResult
484484
if (slug) {
485485
// Try switching using the freshest mode list available
486486
const all = getAllModes(customModesRef.current)

0 commit comments

Comments
 (0)