fix issue where select box does not update when changing saved searches. (#1537)

Reproduction:
1. create a saved search with a custom select ex. Timestamp, Body
2. go to another saved search with a default select (or anywhere with a default select)
3. go back to initial saved search with custom select

Before: observe the SELECT statement is now the default select statement
After: observe that the SELECT statement is now updated as expected

Fixes HDX-3127
This commit is contained in:
Brandon Pereira 2025-12-30 11:00:57 -07:00 committed by GitHub
parent e78960f3bb
commit 11bd8e3df8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"@hyperdx/app": patch
---
Fix issue where select is not updating when loading saved searches

View file

@ -1003,7 +1003,12 @@ function DBSearchPage() {
onFilterChange: handleSetFilters,
});
const watchedSource = useWatch({ control, name: 'source' });
const watchedSource = useWatch({
control,
name: 'source',
// Watch will reset when changing saved search, so we need to default to the URL
defaultValue: searchedConfig.source ?? undefined,
});
const prevSourceRef = useRef(watchedSource);
useEffect(() => {