Skip to content

Commit 6ef52ef

Browse files
author
Katarzyna Ziomek-Zdanowicz
committed
FN Set hiddenVariables in initial FN state
1 parent a4a7748 commit 6ef52ef

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

public/app/fn-app/fn-dashboard-page/render-fn-dashboard.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useEffect, FC, useMemo } from 'react';
33
import { useDispatch } from 'react-redux';
44

55
import { locationService as locationSrv, HistoryWrapper } from '@grafana/runtime';
6-
import { setInitialMountState } from 'app/core/reducers/fn-slice';
6+
import { FnGlobalState, setInitialMountState } from 'app/core/reducers/fn-slice';
77
import DashboardPage, { DashboardPageProps } from 'app/features/dashboard/containers/DashboardPage';
88
import { FnLoggerService } from 'app/fn_logger';
99
import { DashboardRoutes, StoreState, useSelector } from 'app/types';
@@ -68,19 +68,20 @@ export const RenderFNDashboard: FC<FNDashboardProps> = (props) => {
6868
}, [firstError, setErrors]);
6969

7070
useEffect(() => {
71-
FnLoggerService.log(null, '[FN Grafana] Trying to set initial state...');
72-
73-
dispatch(
74-
setInitialMountState({
75-
FNDashboard: true,
76-
uid,
77-
slug,
78-
mode,
79-
controlsContainer,
80-
pageTitle,
81-
queryParams,
82-
})
83-
);
71+
const initialState: FnGlobalState = {
72+
FNDashboard: true,
73+
uid,
74+
slug,
75+
mode,
76+
controlsContainer,
77+
pageTitle,
78+
queryParams,
79+
hiddenVariables,
80+
};
81+
82+
FnLoggerService.log(null, '[FN Grafana] Trying to set initial state.', { initialState });
83+
84+
dispatch(setInitialMountState(initialState));
8485

8586
// TODO: catch success in redux-thunk way
8687
FnLoggerService.log(
@@ -92,8 +93,7 @@ export const RenderFNDashboard: FC<FNDashboardProps> = (props) => {
9293
);
9394

9495
locationService.fnPathnameChange(window.location.pathname, queryParams);
95-
96-
}, [dispatch, uid, slug, controlsContainer, pageTitle, queryParams, mode]);
96+
}, [dispatch, uid, slug, controlsContainer, pageTitle, queryParams, mode, hiddenVariables]);
9797

9898
const dashboardPageProps: DashboardPageProps = useMemo(() => merge({}, DEFAULT_DASHBOARD_PAGE_PROPS, {
9999
...DEFAULT_DASHBOARD_PAGE_PROPS,

0 commit comments

Comments
 (0)