From c093a471e657998b37166b8517c114acc4816a64 Mon Sep 17 00:00:00 2001 From: Levente Balogh Date: Thu, 17 Nov 2022 16:09:06 +0100 Subject: [PATCH] AppRootPage: Fix passing the queryParams (#58912) * fix(AppRootPage): push the query params properly * refactor: remove unnecessary changes in AppRootPage * refactor(AppRootPage): use existing utility function --- public/app/features/plugins/components/AppRootPage.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app/features/plugins/components/AppRootPage.tsx b/public/app/features/plugins/components/AppRootPage.tsx index 40e465cd1d9..0c19ca05dc9 100644 --- a/public/app/features/plugins/components/AppRootPage.tsx +++ b/public/app/features/plugins/components/AppRootPage.tsx @@ -2,10 +2,10 @@ import { AnyAction, createSlice, PayloadAction } from '@reduxjs/toolkit'; import React, { useCallback, useEffect, useMemo, useReducer } from 'react'; import { createHtmlPortalNode, InPortal, OutPortal } from 'react-reverse-portal'; -import { useLocation, useRouteMatch, useParams } from 'react-router-dom'; +import { useLocation, useRouteMatch } from 'react-router-dom'; import { AppEvents, AppPlugin, AppPluginMeta, NavModel, NavModelItem, PluginType } from '@grafana/data'; -import { config } from '@grafana/runtime'; +import { config, locationSearchToObject } from '@grafana/runtime'; import { getNotFoundNav, getWarningNav, getExceptionNav } from 'app/angular/services/nav_model_srv'; import { Page } from 'app/core/components/Page/Page'; import PageLoader from 'app/core/components/PageLoader/PageLoader'; @@ -35,13 +35,13 @@ const initialState: State = { loading: true, pluginNav: null, plugin: null }; export function AppRootPage({ pluginId, pluginNavSection }: Props) { const match = useRouteMatch(); - const queryParams = useParams(); const location = useLocation(); const [state, dispatch] = useReducer(stateSlice.reducer, initialState); const portalNode = useMemo(() => createHtmlPortalNode(), []); const currentUrl = config.appSubUrl + location.pathname + location.search; const { plugin, loading, pluginNav } = state; const navModel = buildPluginSectionNav(pluginNavSection, pluginNav, currentUrl); + const queryParams = useMemo(() => locationSearchToObject(location.search), [location.search]); const context = useMemo(() => buildPluginPageContext(navModel), [navModel]); useEffect(() => {