diff --git a/ui/src/dashboards/actions/v2/views.ts b/ui/src/dashboards/actions/v2/views.ts index 2f49cd3ebd..78ef1a9b5d 100644 --- a/ui/src/dashboards/actions/v2/views.ts +++ b/ui/src/dashboards/actions/v2/views.ts @@ -45,14 +45,16 @@ export const readView = (dashboardID: string, cellID: string) => async ( export const updateView = (dashboardID: string, view: View) => async ( dispatch: Dispatch ): Promise => { - dispatch(setView(view.cellID, null, RemoteDataState.Loading)) + const viewID = view.cellID + + dispatch(setView(viewID, null, RemoteDataState.Loading)) try { - const newView = await updateViewAJAX(dashboardID, view.cellID, view) + const newView = await updateViewAJAX(dashboardID, viewID, view) - dispatch(setView(view.cellID, newView, RemoteDataState.Done)) + dispatch(setView(viewID, newView, RemoteDataState.Done)) return newView } catch { - dispatch(setView(view.cellID, null, RemoteDataState.Error)) + dispatch(setView(viewID, null, RemoteDataState.Error)) } } diff --git a/ui/src/shared/reducers/v2/timeMachines.ts b/ui/src/shared/reducers/v2/timeMachines.ts index 5612c58308..45ed3858a2 100644 --- a/ui/src/shared/reducers/v2/timeMachines.ts +++ b/ui/src/shared/reducers/v2/timeMachines.ts @@ -688,6 +688,8 @@ const convertView = ( newView.properties.queries = cloneDeep(view.properties.queries) newView.name = view.name + newView.cellID = view.cellID + newView.dashboardID = view.dashboardID newView.id = (view as any).id newView.links = (view as any).links diff --git a/ui/src/types/v2/dashboards.ts b/ui/src/types/v2/dashboards.ts index 25516c9182..94994600e4 100644 --- a/ui/src/types/v2/dashboards.ts +++ b/ui/src/types/v2/dashboards.ts @@ -102,7 +102,7 @@ type Omit = Pick> export type NewView = Omit< View, - 'id' | 'links' | 'cellID' | 'dashboardID' + 'id' | 'links' > export interface ViewLinks {