Skip to content

Commit ebde2c2

Browse files
committed
fix: replace unreliable setTimeout with sequential message passing
- Removed setTimeout with hardcoded 100ms delay - Now sending focusInput action immediately after chatButtonClicked - This ensures proper sequencing without arbitrary timing delays - More reliable approach that doesn't depend on timing assumptions
1 parent 0f054a7 commit ebde2c2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/activate/registerCommands.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,9 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
9797
await visibleProvider.removeClineFromStack()
9898
await visibleProvider.postStateToWebview()
9999
await visibleProvider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })
100-
101-
// Focus the input after a short delay to ensure the view has switched
102-
setTimeout(() => {
103-
visibleProvider.postMessageToWebview({ type: "action", action: "focusInput" })
104-
}, 100)
100+
// Send focusInput action immediately after chatButtonClicked
101+
// This ensures the focus happens after the view has switched
102+
await visibleProvider.postMessageToWebview({ type: "action", action: "focusInput" })
105103
},
106104
mcpButtonClicked: () => {
107105
const visibleProvider = getVisibleProviderOrLog(outputChannel)

0 commit comments

Comments
 (0)