Skip to content

Commit

Permalink
fix: cannot switch route from index
Browse files Browse the repository at this point in the history
Signed-off-by: pdamianik <[email protected]>
  • Loading branch information
pdamianik committed Mar 22, 2024
1 parent 248d8f8 commit dbe712f
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions app/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,15 @@
import type { PageData } from './$types';
import { db, type ExistingDocument, type ProductList as PL } from '$lib/db';
import ProductList from '$lib/components/ProductList.svelte';
import { onMount } from 'svelte';
import { browser } from '$app/environment';
export let data: PageData;
console.log($db);
export let lists: ExistingDocument<PL>[] = [];
let cancel_changes: (() => void)[] = [];
onMount(() => {
return () => {
cancel_changes.forEach((cancel) => {
cancel();
});
};
});
data.lists.then((result) => {
lists = result.docs;
cancel_changes = [
...cancel_changes,
if (browser) {
$db
.changes({
since: 'now',
Expand All @@ -49,8 +38,8 @@
console.error('Unreachable. Change event without doc.');
}
}
}).cancel
];
}).cancel;
}
return result;
});
</script>
Expand Down

0 comments on commit dbe712f

Please sign in to comment.