Skip to content

Commit

Permalink
feat: show spinner when rendering list of entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Junk committed Nov 28, 2023
1 parent 31999ea commit 8d5b8e6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/lib/feedview/entries/EntriesByYear.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
<script lang="ts">
import Collapsible from "$lib/Collapsible.svelte";
import UrlCollapsible from "$lib/feedview/entries/URLCollapsible.svelte";
import { appStore } from "$lib/store";
import { tick } from "svelte";
import Entry from "./Entry.svelte";
import type { EntryIDURLLookup, EntryType, Link } from "./entrytypes";
export let entries: EntryType[] = [];
export let year: string;
let rendered = false;
/**
* entryIDURLLookup is a Lookup to link entry IDs to the URL referenced with "self".
*/
Expand All @@ -25,17 +26,20 @@
return acc;
}, {});
const ready = (_) => {
rendered = false;
console.log("finished");
updateUI();
};
async function updateUI() {
await tick();
appStore.setLoading(false);
}
</script>

<div class:collapsible-wait={rendered === true}>
<div>
<Collapsible
header={year}
level="4"
onOpen={() => {
rendered = true;
appStore.setLoading(true);
}}
>
<section use:ready>
Expand Down

0 comments on commit 8d5b8e6

Please sign in to comment.