From 811895b22c332b12f73d3478ba22f3ef95139cd9 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Sat, 24 Feb 2024 14:42:30 +0000 Subject: [PATCH] fix(nocodb): duplicate view with config issue --- packages/nocodb/src/models/View.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/nocodb/src/models/View.ts b/packages/nocodb/src/models/View.ts index 452ef71222..3167de7ca3 100644 --- a/packages/nocodb/src/models/View.ts +++ b/packages/nocodb/src/models/View.ts @@ -1554,10 +1554,16 @@ export default class View implements ViewType { 'base_id', 'source_id', 'order', - 'width', - 'group_by', - 'group_by_order', - 'group_by_sort', + ...(view.type === ViewTypes.FORM + ? [ + 'label', + 'help', + 'description', + 'required', + 'enable_scanner', + 'meta', + ] + : ['width', 'group_by', 'group_by_order', 'group_by_sort']), ]), fk_view_id: view.id, base_id: view.base_id, @@ -1760,6 +1766,7 @@ export default class View implements ViewType { const copyFromView = view.copy_from_id && (await View.get(view.copy_from_id, ncMeta)); + await copyFromView?.getView(); // get base and base id if missing if (!(view.base_id && view.source_id)) { @@ -1809,12 +1816,10 @@ export default class View implements ViewType { ); break; case ViewTypes.FORM: - const copyFromFormView = - view.copy_from_id && (await FormView.get(view.copy_from_id, ncMeta)); await FormView.insert( { heading: view.title, - ...(copyFromFormView || {}), + ...(copyFromView?.view || {}), ...view, fk_view_id: view_id, },