Skip to content

Commit c093a47

Browse files
AppRootPage: Fix passing the queryParams (grafana#58912)
* fix(AppRootPage): push the query params properly * refactor: remove unnecessary changes in AppRootPage * refactor(AppRootPage): use existing utility function
1 parent c14cbfc commit c093a47

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

public/app/features/plugins/components/AppRootPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import { AnyAction, createSlice, PayloadAction } from '@reduxjs/toolkit';
33
import React, { useCallback, useEffect, useMemo, useReducer } from 'react';
44
import { createHtmlPortalNode, InPortal, OutPortal } from 'react-reverse-portal';
5-
import { useLocation, useRouteMatch, useParams } from 'react-router-dom';
5+
import { useLocation, useRouteMatch } from 'react-router-dom';
66

77
import { AppEvents, AppPlugin, AppPluginMeta, NavModel, NavModelItem, PluginType } from '@grafana/data';
8-
import { config } from '@grafana/runtime';
8+
import { config, locationSearchToObject } from '@grafana/runtime';
99
import { getNotFoundNav, getWarningNav, getExceptionNav } from 'app/angular/services/nav_model_srv';
1010
import { Page } from 'app/core/components/Page/Page';
1111
import PageLoader from 'app/core/components/PageLoader/PageLoader';
@@ -35,13 +35,13 @@ const initialState: State = { loading: true, pluginNav: null, plugin: null };
3535

3636
export function AppRootPage({ pluginId, pluginNavSection }: Props) {
3737
const match = useRouteMatch();
38-
const queryParams = useParams();
3938
const location = useLocation();
4039
const [state, dispatch] = useReducer(stateSlice.reducer, initialState);
4140
const portalNode = useMemo(() => createHtmlPortalNode(), []);
4241
const currentUrl = config.appSubUrl + location.pathname + location.search;
4342
const { plugin, loading, pluginNav } = state;
4443
const navModel = buildPluginSectionNav(pluginNavSection, pluginNav, currentUrl);
44+
const queryParams = useMemo(() => locationSearchToObject(location.search), [location.search]);
4545
const context = useMemo(() => buildPluginPageContext(navModel), [navModel]);
4646

4747
useEffect(() => {

0 commit comments

Comments
 (0)