Skip to content

Commit

Permalink
fix: update preview when switching layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
grantjbutler committed Mar 5, 2022
1 parent bbff282 commit 4f3b88f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/renderer/src/store/layouts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineStore } from 'pinia';
import { v4 as uuidv4 } from 'uuid';
import { useLayoutStore } from './layout';
import type { ContainerComponent, Layout } from '/@/layout';
import { FlexComponent } from '/@/layout';

Expand All @@ -26,6 +27,9 @@ export const useLayoutsStore = defineStore('layouts', {
const layout = this.layouts.find(layout => layout.id === id);
if (!layout) { return; }
this.selectedLayout = layout;

const layoutStore = useLayoutStore();
layoutStore.exerciseLayout();
},
setRootComponent(component: ContainerComponent) {
this.selectedLayout.rootComponent = component;
Expand All @@ -38,7 +42,8 @@ export const useLayoutsStore = defineStore('layouts', {
};

this.layouts.push(layout);
this.selectedLayout = layout;

this.selectLayout(layout.id);
},
renameLayout(id: string, newName: string) {
const index = this.layouts.findIndex(layout => layout.id === id);
Expand Down

0 comments on commit 4f3b88f

Please sign in to comment.