Skip to content

Commit

Permalink
fix: safely assign molecule history on load
Browse files Browse the repository at this point in the history
  • Loading branch information
vabe committed Mar 29, 2024
1 parent a0c9cd1 commit 0d9e7e4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
onMount(async () => {
const { StorageHandler } = await import('$lib/storage-handler');
storageHandler = new StorageHandler<MoleculeStorage>('chrome');
moleculeHistory = await storageHandler.get('molecules');
moleculeHistory = await storageHandler.get('molecules') ?? [];
});
async function getMolecule() {
Expand Down Expand Up @@ -74,7 +74,6 @@
}
function handleClearHistory() {
console.log('Clearing history');
moleculeHistory = [];
moleculeHistory = moleculeHistory;
}
Expand Down

0 comments on commit 0d9e7e4

Please sign in to comment.