diff --git a/packages/builder/src/builderStore/store.js b/packages/builder/src/builderStore/store.js index 24362dfbce..faec68231f 100644 --- a/packages/builder/src/builderStore/store.js +++ b/packages/builder/src/builderStore/store.js @@ -499,6 +499,7 @@ const savePage = store => async page => { } s.pages[s.currentPageName] = page; + s.currentFrontEndItem = page; savePackage(store, s); return s; }); diff --git a/packages/builder/src/userInterface/PageView.svelte b/packages/builder/src/userInterface/PageView.svelte index 6393599c0d..f2a8ed60d3 100644 --- a/packages/builder/src/userInterface/PageView.svelte +++ b/packages/builder/src/userInterface/PageView.svelte @@ -5,22 +5,29 @@ import Dropdown from "../common/Dropdown.svelte"; import Button from "../common/Button.svelte"; import { store } from "../builderStore"; import { isRootComponent } from "./pagesParsing/searchComponents"; +import { pipe } from "../common/core"; import { - filter, - find + filter, find, concat } from "lodash/fp"; let entryComponent; let title = ""; let components = []; +const notSeletedComponent = {name:"(none selected)"}; + store.subscribe(s => { title = s.currentFrontEndItem.index.title; - components = filter(s => !isRootComponent(s))(s.allComponents); + components = pipe(s.allComponents, [ + filter(s => !isRootComponent(s)), + concat([notSeletedComponent]) + ]); entryComponent = find(c => c.name === s.currentFrontEndItem.appBody)(components); + if(!entryComponent) entryComponent = notSeletedComponent; }); const save = () => { + if(!title || !entryComponent || entryComponent === notSeletedComponent) return; const page = { index: { title @@ -37,7 +44,7 @@ const save = () => {