Add command to open the search page in the current tab#2396
Add command to open the search page in the current tab#2396szdarkhack wants to merge 1 commit intoyomidevs:masterfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64065e6c4d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| case 'existingOrCurrentTab': | ||
| try { | ||
| if (await openInTab()) { return; } |
There was a problem hiding this comment.
Bypass existing-tab reuse for current-tab search command
The new existingOrCurrentTab mode still goes through openInTab(), so openSearchPageCurrentTab can focus an already-open search tab in another tab/window and return without touching the active tab. This breaks the command’s advertised behavior (“open ... in the current tab”) whenever any /search.html tab already exists. The current-tab mode should skip the existing-tab lookup and always navigate the active tab.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This follows the behavior of the current "Open search page" command (which uses existingOrNewTab), i.e. prioritizing focusing an existing search page if it exists, instead of opening a new one. I think the behavior is fairly intuitive (only one search page open at any time) once the user comes across it, but improving the description is always an option.
This addresses #2393. I'll be the first to admit that JS/TS is certainly not my forte, but I tried to do minimal/sensible things (and followed the linter). Please feel free to point out any issues.
The changes resulted in the exact same
npm testoutput asmaster, and I sucessfully tested the functionality on Firefox 150.0 & Chrome 147.0.7727.102 on Windows 11. As described in the issue, the new command is unbound by default.