From eeea70d351bab8e63bb6294278f6cc99ec106f8c Mon Sep 17 00:00:00 2001 From: Claire Lin Date: Mon, 11 Mar 2024 16:19:42 -0700 Subject: [PATCH] initialize upon load --- .../dagster-ui/packages/ui-core/src/search/AssetSearch.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js_modules/dagster-ui/packages/ui-core/src/search/AssetSearch.tsx b/js_modules/dagster-ui/packages/ui-core/src/search/AssetSearch.tsx index 97a34eefdc701..9e6eb256f0b13 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/search/AssetSearch.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/search/AssetSearch.tsx @@ -19,7 +19,6 @@ type State = { searching: boolean; secondaryResults: Fuse.FuseResult[]; highlight: number; - loaded: boolean; }; type Action = @@ -48,7 +47,6 @@ const initialState: State = { searching: false, secondaryResults: [], highlight: 0, - loaded: false, }; const DEBOUNCE_MSEC = 100; @@ -69,7 +67,7 @@ function groupSearchResults(secondaryResults: Fuse.FuseResult[]): export const AssetSearch = () => { const history = useHistory(); - const {loading, searchSecondary} = useGlobalSearch({ + const {loading, searchSecondary, initialize} = useGlobalSearch({ includeAssetFilters: true, }); @@ -88,10 +86,11 @@ export const AssetSearch = () => { const firstSearchTrace = React.useRef(null); React.useEffect(() => { + initialize(); if (!loading && secondaryResults) { firstSearchTrace.current?.endTrace(); } - }, [loading, secondaryResults]); + }, [loading, secondaryResults, initialize]); const searchAndHandleSecondary = React.useCallback( async (queryString: string) => {