Skip to content

Commit

Permalink
initialize upon load
Browse files Browse the repository at this point in the history
  • Loading branch information
clairelin135 committed Mar 11, 2024
1 parent f41fcff commit 8ea6b1f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function groupSearchResults(secondaryResults: Fuse.FuseResult<SearchResult>[]):

export const AssetSearch = () => {
const history = useHistory();
const {loading, searchSecondary} = useGlobalSearch({
const {loading, searchSecondary, initialize} = useGlobalSearch({
includeAssetFilters: true,
});

Expand All @@ -88,10 +88,11 @@ export const AssetSearch = () => {
const firstSearchTrace = React.useRef<null | Trace>(null);

React.useEffect(() => {
initialize();
if (!loading && secondaryResults) {
firstSearchTrace.current?.endTrace();
}
}, [loading, secondaryResults]);
}, [loading, secondaryResults, initialize]);

const searchAndHandleSecondary = React.useCallback(
async (queryString: string) => {
Expand Down

0 comments on commit 8ea6b1f

Please sign in to comment.