mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-26 09:14:27 +08:00
fix: dashboard context is updated when we update (#3718)
This commit is contained in:
parent
a912731cc7
commit
ca3283fcad
@ -27,7 +27,12 @@ function GraphLayout({
|
|||||||
onAddPanelHandler,
|
onAddPanelHandler,
|
||||||
widgets,
|
widgets,
|
||||||
}: GraphLayoutProps): JSX.Element {
|
}: GraphLayoutProps): JSX.Element {
|
||||||
const { selectedDashboard, layouts, setLayouts } = useDashboard();
|
const {
|
||||||
|
selectedDashboard,
|
||||||
|
layouts,
|
||||||
|
setLayouts,
|
||||||
|
setSelectedDashboard,
|
||||||
|
} = useDashboard();
|
||||||
const { t } = useTranslation(['dashboard']);
|
const { t } = useTranslation(['dashboard']);
|
||||||
|
|
||||||
const { featureResponse, role } = useSelector<AppState, AppReducer>(
|
const { featureResponse, role } = useSelector<AppState, AppReducer>(
|
||||||
@ -58,12 +63,17 @@ function GraphLayout({
|
|||||||
};
|
};
|
||||||
|
|
||||||
updateDashboardMutation.mutate(updatedDashboard, {
|
updateDashboardMutation.mutate(updatedDashboard, {
|
||||||
onSuccess: () => {
|
onSuccess: (updatedDashboard) => {
|
||||||
featureResponse.refetch();
|
if (updatedDashboard.payload) {
|
||||||
|
if (updatedDashboard.payload.data.layout)
|
||||||
|
setLayouts(updatedDashboard.payload.data.layout);
|
||||||
|
setSelectedDashboard(updatedDashboard.payload);
|
||||||
|
}
|
||||||
notifications.success({
|
notifications.success({
|
||||||
message: t('dashboard:layout_saved_successfully'),
|
message: t('dashboard:layout_saved_successfully'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
featureResponse.refetch();
|
||||||
},
|
},
|
||||||
onError: () => {
|
onError: () => {
|
||||||
notifications.error({
|
notifications.error({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user