mirror of
https://github.com/grafana/grafana.git
synced 2026-07-30 00:08:10 -05:00
Search: Fix select item pressing enter 404 (#24634)
* Remove appSubUrl for navigation * stripBaseFromUrl * Remove unused imports
This commit is contained in:
@@ -5,6 +5,7 @@ import { MOVE_SELECTION_DOWN, MOVE_SELECTION_UP } from '../reducers/actionTypes'
|
||||
import { dashboardsSearchState, DashboardsSearchState, searchReducer } from '../reducers/dashboardSearch';
|
||||
import { findSelected } from '../utils';
|
||||
import { useSearch } from './useSearch';
|
||||
import { locationUtil } from '@grafana/data';
|
||||
|
||||
export const useDashboardSearch = (query: DashboardQuery, onCloseSearch: () => void) => {
|
||||
const reducer = useReducer(searchReducer, dashboardsSearchState);
|
||||
@@ -31,7 +32,9 @@ export const useDashboardSearch = (query: DashboardQuery, onCloseSearch: () => v
|
||||
if (selectedItem.type === DashboardSearchItemType.DashFolder) {
|
||||
onToggleSection(selectedItem as DashboardSection);
|
||||
} else {
|
||||
getLocationSrv().update({ path: selectedItem.url });
|
||||
getLocationSrv().update({
|
||||
path: locationUtil.stripBaseFromUrl(selectedItem.url),
|
||||
});
|
||||
// Delay closing to prevent current page flicker
|
||||
setTimeout(onCloseSearch, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user