mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 21:09:03 +08:00
fix: fixed widgets not visible after saving in the dashboard detail (#7106)
This commit is contained in:
parent
2d6131c291
commit
50ecf768fa
@ -66,6 +66,7 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
|
|||||||
dashboardQueryRangeCalled,
|
dashboardQueryRangeCalled,
|
||||||
setDashboardQueryRangeCalled,
|
setDashboardQueryRangeCalled,
|
||||||
setSelectedRowWidgetId,
|
setSelectedRowWidgetId,
|
||||||
|
isDashboardFetching,
|
||||||
} = useDashboard();
|
} = useDashboard();
|
||||||
const { data } = selectedDashboard || {};
|
const { data } = selectedDashboard || {};
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
@ -231,7 +232,8 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element {
|
|||||||
!isEqual(layouts, dashboardLayout) &&
|
!isEqual(layouts, dashboardLayout) &&
|
||||||
!isDashboardLocked &&
|
!isDashboardLocked &&
|
||||||
saveLayoutPermission &&
|
saveLayoutPermission &&
|
||||||
!updateDashboardMutation.isLoading
|
!updateDashboardMutation.isLoading &&
|
||||||
|
!isDashboardFetching
|
||||||
) {
|
) {
|
||||||
onSaveHandler();
|
onSaveHandler();
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,7 @@ const DashboardContext = createContext<IDashboardContext>({
|
|||||||
setDashboardQueryRangeCalled: () => {},
|
setDashboardQueryRangeCalled: () => {},
|
||||||
selectedRowWidgetId: '',
|
selectedRowWidgetId: '',
|
||||||
setSelectedRowWidgetId: () => {},
|
setSelectedRowWidgetId: () => {},
|
||||||
|
isDashboardFetching: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -192,6 +193,8 @@ export function DashboardProvider({
|
|||||||
const { t } = useTranslation(['dashboard']);
|
const { t } = useTranslation(['dashboard']);
|
||||||
const dashboardRef = useRef<Dashboard>();
|
const dashboardRef = useRef<Dashboard>();
|
||||||
|
|
||||||
|
const [isDashboardFetching, setIsDashboardFetching] = useState<boolean>(false);
|
||||||
|
|
||||||
const mergeDBWithLocalStorage = (
|
const mergeDBWithLocalStorage = (
|
||||||
data: Dashboard,
|
data: Dashboard,
|
||||||
localStorageVariables: any,
|
localStorageVariables: any,
|
||||||
@ -256,10 +259,16 @@ export function DashboardProvider({
|
|||||||
[REACT_QUERY_KEY.DASHBOARD_BY_ID, isDashboardPage?.params],
|
[REACT_QUERY_KEY.DASHBOARD_BY_ID, isDashboardPage?.params],
|
||||||
{
|
{
|
||||||
enabled: (!!isDashboardPage || !!isDashboardWidgetPage) && isLoggedIn,
|
enabled: (!!isDashboardPage || !!isDashboardWidgetPage) && isLoggedIn,
|
||||||
queryFn: () =>
|
queryFn: async () => {
|
||||||
getDashboard({
|
setIsDashboardFetching(true);
|
||||||
uuid: dashboardId,
|
try {
|
||||||
}),
|
return await getDashboard({
|
||||||
|
uuid: dashboardId,
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setIsDashboardFetching(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
refetchOnWindowFocus: false,
|
refetchOnWindowFocus: false,
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
const updatedDashboardData = transformDashboardVariables(data);
|
const updatedDashboardData = transformDashboardVariables(data);
|
||||||
@ -424,6 +433,7 @@ export function DashboardProvider({
|
|||||||
setDashboardQueryRangeCalled,
|
setDashboardQueryRangeCalled,
|
||||||
selectedRowWidgetId,
|
selectedRowWidgetId,
|
||||||
setSelectedRowWidgetId,
|
setSelectedRowWidgetId,
|
||||||
|
isDashboardFetching,
|
||||||
}),
|
}),
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
[
|
[
|
||||||
@ -445,6 +455,7 @@ export function DashboardProvider({
|
|||||||
setDashboardQueryRangeCalled,
|
setDashboardQueryRangeCalled,
|
||||||
selectedRowWidgetId,
|
selectedRowWidgetId,
|
||||||
setSelectedRowWidgetId,
|
setSelectedRowWidgetId,
|
||||||
|
isDashboardFetching,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -47,4 +47,5 @@ export interface IDashboardContext {
|
|||||||
setDashboardQueryRangeCalled: (value: boolean) => void;
|
setDashboardQueryRangeCalled: (value: boolean) => void;
|
||||||
selectedRowWidgetId: string | null;
|
selectedRowWidgetId: string | null;
|
||||||
setSelectedRowWidgetId: React.Dispatch<React.SetStateAction<string | null>>;
|
setSelectedRowWidgetId: React.Dispatch<React.SetStateAction<string | null>>;
|
||||||
|
isDashboardFetching: boolean;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user