Fix state when deleting frontend components

This commit is contained in:
Andrew Kingston 2020-10-13 09:06:56 +01:00
parent 5af85541ec
commit b60f86715d
1 changed files with 9 additions and 8 deletions

View File

@ -1,15 +1,10 @@
<script>
import { goto } from "@sveltech/routify"
import { store } from "builderStore"
import { getComponentDefinition } from "builderStore/storeUtils"
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { last, cloneDeep } from "lodash/fp"
import {
selectComponent,
getParent,
walkProps,
saveCurrentPreviewItem,
regenerateCssForCurrentScreen,
} from "builderStore/storeUtils"
import { getParent, saveCurrentPreviewItem } from "builderStore/storeUtils"
import { uuid } from "builderStore/uuid"
import { DropdownMenu } from "@budibase/bbui"
@ -29,6 +24,12 @@
dropdown.hide()
}
const selectComponent = component => {
store.selectComponent(component)
const path = store.getPathToComponent(component)
$goto(`./:page/:screen/${path}`)
}
const moveUpComponent = () => {
store.update(s => {
const parent = getParent(s.currentPreviewItem.props, component)
@ -78,10 +79,10 @@
if (parent) {
parent._children = parent._children.filter(c => c !== component)
selectComponent(parent)
}
saveCurrentPreviewItem(state)
return state
})
}