diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index e5e5413111..130ca0c454 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -80,13 +80,11 @@ export const getBackendUiStore = () => { state.draftModel.schema = {} } - const id = uuid() - state.draftModel.schema = { ...state.draftModel.schema, - [id]: field, + [field.name]: field, } - state.selectedField = id + state.selectedField = field.name state.tabs.NAVIGATION_PANEL = "NAVIGATE" return state diff --git a/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte b/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte index 5feb5b3a57..cd7024af0a 100644 --- a/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte +++ b/packages/builder/src/components/nav/ModelNavigator/EmptyModel.svelte @@ -12,16 +12,12 @@ function createModel(model) { const { schema, ...rest } = $backendUiStore.selectedModel - const newModel = { ...model, schema: {} } - - // TODO: could be better - for (let key in model.schema) { - newModel.schema[uuid()] = model.schema[key] - } + // const newModel = { ...model, schema: {} } backendUiStore.actions.models.save({ model: { - ...newModel, + ...model, + schema: {}, ...rest, }, })