Fix selecting screen on undo
This commit is contained in:
parent
9d5f501d2a
commit
12ab5637c1
|
@ -1437,8 +1437,6 @@ class AutomationStore extends BudiStore<AutomationState> {
|
|||
this.history = createHistoryStore({
|
||||
getDoc: this.actions.getDefinition.bind(this),
|
||||
selectDoc: this.actions.select.bind(this),
|
||||
beforeAction: () => {},
|
||||
afterAction: () => {},
|
||||
})
|
||||
|
||||
// Then wrap save and delete with history
|
||||
|
|
|
@ -58,13 +58,12 @@ export class ScreenStore extends BudiStore<ScreenState> {
|
|||
getDoc: (id: string) =>
|
||||
get(this.store).screens?.find(screen => screen._id === id),
|
||||
selectDoc: this.select,
|
||||
beforeAction: () => {},
|
||||
afterAction: () => {
|
||||
// Ensure a valid component is selected
|
||||
if (!get(selectedComponent)) {
|
||||
this.update(state => ({
|
||||
componentStore.update(state => ({
|
||||
...state,
|
||||
selectedComponentId: get(selectedScreen)?.props._id,
|
||||
selectedComponentId: get(selectedScreen)?._id,
|
||||
}))
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue