message: fix: dashboard save layout
diff: @@ -113,10 +113,8 @@ function GridGraph(props: Props): JSX.Element {
  errorMessage: '',
  loading: true,
  }));
  -
  - // Save layout only when users has the has the permission to do so.
  - if (saveLayoutPermission) {
  - const response = await updateDashboardApi({
  + const updatedDashboard: Dashboard = {
  + ...selectedDashboard,
  data: {
  title: data.title,
  description: data.description,
  @@ -126,7 +124,10 @@ function GridGraph(props: Props): JSX.Element {
  layout,
  },
  uuid: selectedDashboard.uuid,
  - });
  + };
  + // Save layout only when users has the has the permission to do so.
  + if (saveLayoutPermission) {
  + const response = await updateDashboardApi(updatedDashboard);
  if (response.statusCode === 200) {
  setSaveLayoutState((state) => ({
  ...state,
  @@ -134,6 +135,10 @@ function GridGraph(props: Props): JSX.Element {
  errorMessage: '',
  loading: false,
  }));
  + dispatch({
  + type: UPDATE_DASHBOARD,
  + payload: updatedDashboard,
  + });
  } else {
  setSaveLayoutState((state) => ({
  ...state,
  @@ -153,8 +158,9 @@ function GridGraph(props: Props): JSX.Element {
  data.tags,
  data.title,
  data.widgets,
  + dispatch,
  saveLayoutPermission,
  - selectedDashboard.uuid,
  + selectedDashboard,
  ],
  );
  