Skip to content

Commit 171b1dd

Browse files
committed
refactor(view): set default version into generate function
1 parent f3ecb40 commit 171b1dd

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

frontend/src/app/pages/MainPage/pages/ViewPage/slice/thunks.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,7 @@ export const saveView = createAsyncThunk<
206206
? (currentView as ViewViewModel)
207207
: (selectCurrentEditingView(getState()) as ViewViewModel);
208208
const orgId = selectOrgId(getState());
209-
210-
// keep to save view model config version
211-
if (currentEditingView?.model && !currentEditingView?.model?.version) {
212-
currentEditingView = produce(currentEditingView, draft => {
213-
draft.model = Object.assign({}, currentEditingView.model, {
214-
version: APP_CURRENT_VERSION,
215-
});
216-
});
217-
}
209+
218210
try {
219211
if (isNewView(currentEditingView.id) || isSaveAs) {
220212
const { data } = await request<View>({

frontend/src/app/pages/MainPage/pages/ViewPage/utils.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
import { TreeDataNode } from 'antd';
20+
import { APP_CURRENT_VERSION } from 'app/migration/constants';
2021
import { FONT_WEIGHT_MEDIUM, SPACE_UNIT } from 'styles/StyleConstants';
2122
import { Nullable } from 'types';
2223
import { isEmptyArray } from 'utils/object';
@@ -47,7 +48,9 @@ export function generateEditingView(
4748
index: null,
4849
script: '',
4950
config: {},
50-
model: {},
51+
model: {
52+
version: APP_CURRENT_VERSION,
53+
},
5154
originVariables: [],
5255
variables: [],
5356
originColumnPermissions: [],

0 commit comments

Comments
 (0)