Skip to content

Commit d81a77f

Browse files
committed
Restrict tab reuse to matching client ID and chatbot
- do we reuse the same browser tab for autofills from different editor ids? should not - the same browser tab should not be reused even for the same client id when chatbot is different ├── apps │ ├── browser │ │ └── src │ │ ├── background │ │ │ ├── main.ts │ │ │ ├── message-handler.ts │ │ │ └── websocket.ts │ │ ├── content-scripts │ │ │ └── send-prompt-content-script │ │ │ ├── send-prompt-content-script.ts │ │ │ └── utils │ │ │ └── add-apply-response-button.ts │ │ └── types │ │ └── messages.ts │ └── editor │ └── src │ ├── commands │ │ ├── code-at-cursor-command │ │ │ └── utils │ │ │ └── perform-code-at-cursor.ts │ │ └── generate-commit-message-commands │ │ └── actions │ │ └── run-generate-action.ts │ ├── extension.ts │ ├── features │ │ └── search-files │ │ └── search-modes │ │ └── perform-intelligent-search-mode.ts │ ├── services │ │ ├── websocket-manager.ts │ │ └── websocket-server-process.ts │ └── views │ └── prompt │ ├── backend │ │ ├── message-handlers │ │ │ ├── handle-autofill.ts │ │ │ └── handle-patch-repair.ts │ │ └── prompt-view-provider.ts │ └── frontend │ └── Main │ └── Main.tsx └── packages └── shared └── src └── types └── websocket-message.ts
1 parent 0d9bf1a commit d81a77f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎apps/browser/src/background/message-handler.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ let is_processing = false
1818
let is_waiting_for_focus = false
1919
let is_first_item_in_queue = true
2020
let last_opened_tab_id: number | undefined
21+
let last_opened_tab_client_id: string | undefined
22+
let last_opened_tab_chatbot: string | undefined
2123
let last_opened_tab_injected_apply_button = false
2224
let is_finished_responding = false
2325

@@ -109,6 +111,8 @@ const process_next_chat = async () => {
109111

110112
if (
111113
last_opened_tab_id !== undefined &&
114+
last_opened_tab_client_id === current_chat_message.client_id &&
115+
last_opened_tab_chatbot === current_chat_message.chatbot &&
112116
is_finished_responding &&
113117
last_opened_tab_injected_apply_button
114118
) {
@@ -123,6 +127,8 @@ const process_next_chat = async () => {
123127
}
124128
} catch {
125129
last_opened_tab_id = undefined
130+
last_opened_tab_client_id = undefined
131+
last_opened_tab_chatbot = undefined
126132
}
127133
}
128134

@@ -133,6 +139,8 @@ const process_next_chat = async () => {
133139
}
134140
const new_tab = await browser.tabs.create(create_tab_options)
135141
last_opened_tab_id = new_tab.id
142+
last_opened_tab_client_id = current_chat_message.client_id
143+
last_opened_tab_chatbot = current_chat_message.chatbot
136144
}
137145

138146
last_opened_tab_injected_apply_button =

0 commit comments

Comments
 (0)