X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/519b431a41a9ab4815a1e4180ee78395b74a85de..5ec3f2a5dd1e0dd3cf439b46ea9eebecbd0eb250:/src/store/search-results-panel/search-results-panel-actions.ts diff --git a/src/store/search-results-panel/search-results-panel-actions.ts b/src/store/search-results-panel/search-results-panel-actions.ts index f7dc5d45..20a14b2e 100644 --- a/src/store/search-results-panel/search-results-panel-actions.ts +++ b/src/store/search-results-panel/search-results-panel-actions.ts @@ -7,6 +7,7 @@ import { RootState } from '~/store/store'; import { ServiceRepository } from '~/services/services'; import { bindDataExplorerActions } from '~/store/data-explorer/data-explorer-action'; import { setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions'; +import { searchBarActions } from '~/store/search-bar/search-bar-actions'; export const SEARCH_RESULTS_PANEL_ID = "searchResultsPanel"; export const searchResultsPanelActions = bindDataExplorerActions(SEARCH_RESULTS_PANEL_ID); @@ -14,5 +15,15 @@ export const searchResultsPanelActions = bindDataExplorerActions(SEARCH_RESULTS_ export const loadSearchResultsPanel = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { dispatch(setBreadcrumbs([{ label: 'Search results' }])); - dispatch(searchResultsPanelActions.REQUEST_ITEMS()); - }; \ No newline at end of file + const loc = getState().router.location; + if (loc !== null) { + const search = new URLSearchParams(loc.search); + const q = search.get('q'); + if (q !== null) { + dispatch(searchBarActions.SET_SEARCH_VALUE(q)); + } + } + dispatch(searchBarActions.SET_SEARCH_RESULTS([])); + dispatch(searchResultsPanelActions.CLEAR()); + dispatch(searchResultsPanelActions.REQUEST_ITEMS(true)); + };