-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Auto-switch to Search tab when query parameters are present in URL (resolves #331). #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4871fcc
e43f4dc
ed3560b
3bcaaea
ae20cb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -110,6 +110,7 @@ const handleQueryResults = (progress: number, results: QueryResults) => { | |||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
// eslint-disable-next-line max-lines-per-function | ||||||||||||||||||||||||||||||
Henry8192 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||
const useLogFileStore = create<LogFileState>((set) => ({ | ||||||||||||||||||||||||||||||
...LOG_FILE_STORE_DEFAULT, | ||||||||||||||||||||||||||||||
loadFile: (fileSrc: FileSrcType, cursor: CursorType) => { | ||||||||||||||||||||||||||||||
|
@@ -166,6 +167,8 @@ const useLogFileStore = create<LogFileState>((set) => ({ | |||||||||||||||||||||||||||||
setUiState(UI_STATE.READY); | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
if (updateQueryHashParams()) { | ||||||||||||||||||||||||||||||
const {setActiveTabName} = useUiStore.getState(); | ||||||||||||||||||||||||||||||
setActiveTabName(TAB_NAME.SEARCH); | ||||||||||||||||||||||||||||||
const {startQuery} = useQueryStore.getState(); | ||||||||||||||||||||||||||||||
startQuery(); | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
Comment on lines
169
to
174
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify no duplicate startQuery/tab-switch triggers across handlers The AI summary notes AppController.tsx also switches to SEARCH and calls startQuery() when query hash params are present. Ensure we don’t trigger startQuery twice (once here and once in AppController) for the same navigation, which could cause duplicate work. Consider centralising the “hash-param detected → switch to SEARCH → startQuery” flow in a single place (either AppController or this store) to avoid duplication. Run this script to locate all call sites: 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== updateQueryHashParams call sites ==="
rg -n -A 3 -B 3 $'updateQueryHashParams\\('
echo -e "\n=== startQuery call sites ==="
rg -n -A 3 -B 3 $'startQuery\\('
echo -e "\n=== setActiveTabName call sites ==="
rg -n -A 3 -B 3 $'setActiveTabName\\(' Length of output: 9733 Centralize hash-param handling to avoid duplicate searches Both Please consolidate this flow in one place or add a guard to prevent back-to-back triggers: • src/stores/logFileStore.ts (lines 154–159) Consider moving the hash-param → tab switch → 🤖 Prompt for AI Agents
🧹 Nitpick (assertive) Guard against redundant tab updates to avoid unnecessary re-renders If the UI is already on the Search tab, skip dispatching setActiveTabName to reduce churn. Apply this diff: - const {setActiveTabName} = useUiStore.getState();
- setActiveTabName(TAB_NAME.SEARCH);
+ const {activeTabName, setActiveTabName} = useUiStore.getState();
+ if (TAB_NAME.SEARCH !== activeTabName) {
+ setActiveTabName(TAB_NAME.SEARCH);
+ } 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.