Fix state when deleting frontend components
This commit is contained in:
parent
845d909087
commit
06d83c7ad5
|
@ -1,15 +1,10 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { goto } from "@sveltech/routify"
|
||||||
import { store } from "builderStore"
|
import { store } from "builderStore"
|
||||||
import { getComponentDefinition } from "builderStore/storeUtils"
|
import { getComponentDefinition } from "builderStore/storeUtils"
|
||||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||||
import { last, cloneDeep } from "lodash/fp"
|
import { last, cloneDeep } from "lodash/fp"
|
||||||
import {
|
import { getParent, saveCurrentPreviewItem } from "builderStore/storeUtils"
|
||||||
selectComponent,
|
|
||||||
getParent,
|
|
||||||
walkProps,
|
|
||||||
saveCurrentPreviewItem,
|
|
||||||
regenerateCssForCurrentScreen,
|
|
||||||
} from "builderStore/storeUtils"
|
|
||||||
import { uuid } from "builderStore/uuid"
|
import { uuid } from "builderStore/uuid"
|
||||||
import { DropdownMenu } from "@budibase/bbui"
|
import { DropdownMenu } from "@budibase/bbui"
|
||||||
|
|
||||||
|
@ -29,6 +24,12 @@
|
||||||
dropdown.hide()
|
dropdown.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const selectComponent = component => {
|
||||||
|
store.selectComponent(component)
|
||||||
|
const path = store.getPathToComponent(component)
|
||||||
|
$goto(`./:page/:screen/${path}`)
|
||||||
|
}
|
||||||
|
|
||||||
const moveUpComponent = () => {
|
const moveUpComponent = () => {
|
||||||
store.update(s => {
|
store.update(s => {
|
||||||
const parent = getParent(s.currentPreviewItem.props, component)
|
const parent = getParent(s.currentPreviewItem.props, component)
|
||||||
|
@ -78,10 +79,10 @@
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent._children = parent._children.filter(c => c !== component)
|
parent._children = parent._children.filter(c => c !== component)
|
||||||
|
selectComponent(parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
saveCurrentPreviewItem(state)
|
saveCurrentPreviewItem(state)
|
||||||
|
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue