feat: preserve user's language preference in search page#1775
feat: preserve user's language preference in search page#1775akshat1074 wants to merge 3 commits intohyperdxio:mainfrom
Conversation
|
|
@akshat1074 is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
PR Review: feat: preserve user's language preference in search pageSummary: Saves/restores language preference (sql/lucene) to localStorage. The previous
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@akshat1074, thanks for creating this PR. I noticed that when we navigate to another page and then return to the search page, the selected language preference is lost. Here’s a recording for reference: Google.Chrome.mp4I have a PR that creates a new component to handle the SQL/Lucene search input. And I'm adding the user language preference there: #1726. |
|
@elizabetdev – Thanks to you! My approach was so naive compared to yours. Yours was so professional, and I’ve learned so much . Would love to connect and continue learning. |
Fixes #1666
Problem
Users' search language preference (SQL vs Lucene) was not being preserved across page refreshes. The default was hardcoded to 'lucene' in multiple places, so switching to SQL would reset back to Lucene on every page reload.
Root Cause
The whereLanguage field was hardcoded to 'lucene' as the default in setSearchedConfig and useForm, with no mechanism to remember the user's preference.
Changes Made
tslocalStorage.setItem('hdx-search-language-preference', lang);
tswhereLanguage: searchedConfig.whereLanguage ??
(localStorage.getItem('hdx-search-language-preference') as 'sql' | 'lucene') ??
'lucene',
Behavior
Toggle language → saved to localStorage instantly
Hit Run → URL updates with correct language
Refresh page → localStorage fallback restores preference
Saved searches → still respect their own stored language preference
Screen.Recording.2026-02-22.175844.mp4