Skip to content

Commit

Permalink
Fix bug in initializeScreen #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Lev Z Király authored and Lev Z Király committed Nov 22, 2023
1 parent 2033d2e commit 26db36a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions stores/use-windows-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,24 @@ export const useWindowsStore = defineStore("windows", () => {
const router = useRouter();
const route = useRoute();

function initializeScreen() {
navigateTo({
async function initializeScreen() {
await navigateTo({
path: "/",
query: { w: "[]", a: windowsStore.arrangement },
query: { w: "[]", a: arrangement },
});
}

const restoreState = async () => {
if (!route.query.w || !route.query.a) {
initializeScreen();
await initializeScreen();
return;
}

// TODO validate with zod
let windowState = JSON.parse(route.query.w as string);
if (!Array.isArray(windowState)) {
initializeScreen();
await initializeScreen();
return;
}

await nextTick();
Expand Down
1 change: 1 addition & 0 deletions vicav-app-api
Submodule vicav-app-api added at 7ae96b

0 comments on commit 26db36a

Please sign in to comment.