Skip to content

Commit e478f18

Browse files
committed
Require apply button injection for tab reuse
- only reuse last tab if 'inject apply button' was true ├── apps │ ├── browser │ │ └── src │ │ ├── background │ │ │ ├── keep-alive.ts │ │ │ ├── main.ts │ │ │ ├── message-handler.ts │ │ │ └── websocket.ts │ │ ├── content-scripts │ │ │ └── send-prompt-content-script │ │ │ └── send-prompt-content-script.ts │ │ └── types │ │ └── messages.ts │ └── editor │ └── src │ ├── services │ │ ├── websocket-manager.ts │ │ └── websocket-server-process.ts │ └── views │ └── prompt │ └── backend │ └── message-handlers │ ├── handle-autofill.ts │ ├── handle-patch-repair.ts │ └── handle-preview-web-configuration.ts └── packages ├── shared │ └── src │ ├── constants │ │ └── websocket.ts │ └── types │ ├── prompt-types.ts │ └── websocket-message.ts └── ui └── src └── components └── editor └── common ├── Tooltip │ ├── Tooltip.module.scss │ ├── Tooltip.tsx │ └── index.ts └── prompts ├── PromptField │ ├── PromptField.module.scss │ ├── PromptField.stories.tsx │ ├── PromptField.tsx │ ├── components │ │ ├── CompletedTasks │ │ │ ├── CompletedTasks.module.scss │ │ │ ├── CompletedTasks.tsx │ │ │ └── index.ts │ │ ├── Footer │ │ │ ├── Footer.module.scss │ │ │ ├── Footer.tsx │ │ │ └── index.ts │ │ └── Tabs │ │ ├── Tabs.module.scss │ │ ├── Tabs.tsx │ │ └── index.ts │ ├── hooks │ │ ├── use-drag-drop.ts │ │ ├── use-dropdown.ts │ │ ├── use-ghost-text.ts │ │ ├── use-handlers │ │ │ ├── handle-copy.ts │ │ │ ├── handle-cut.ts │ │ │ ├── handle-input-change.ts │ │ │ ├── handle-input-click.ts │ │ │ ├── handle-key-down.ts │ │ │ ├── handle-paste.ts │ │ │ ├── handle-submit.ts │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ ├── use-handlers.ts │ │ │ └── utils.ts │ │ └── use-keyboard-shortcuts.ts │ └── index.ts ├── Template │ ├── Template.module.scss │ ├── Template.tsx │ └── index.ts └── shared └── symbols ├── caret.ts ├── get-highlighted-text.tsx ├── index.ts ├── position-mapping.ts ├── prompt-symbols.module.scss ├── reconstruct-raw-value.ts └── use-symbol-deletion.ts
1 parent 27b2909 commit e478f18

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ let is_processing = false
1717
let is_waiting_for_focus = false
1818
let is_first_item_in_queue = true
1919
let last_opened_tab_id: number | undefined
20+
let last_opened_tab_injected_apply_button = false
2021
let is_finished_responding = false
2122

2223
const CHAT_INITIALIZATION_TIMEOUT = 5000
@@ -118,7 +119,7 @@ const process_next_chat = async () => {
118119

119120
let tab_reused = false
120121

121-
if (last_opened_tab_id !== undefined && is_finished_responding) {
122+
if (last_opened_tab_id !== undefined && is_finished_responding && last_opened_tab_injected_apply_button) {
122123
try {
123124
const tab = await browser.tabs.get(last_opened_tab_id)
124125
if (tab.active) {
@@ -142,6 +143,7 @@ const process_next_chat = async () => {
142143
last_opened_tab_id = new_tab.id
143144
}
144145

146+
last_opened_tab_injected_apply_button = current_chat_message.inject_apply_response_button ?? false
145147
is_finished_responding = false
146148

147149
current_queue_item.timeout_id = setTimeout(() => {

0 commit comments

Comments
 (0)