1
0
Fork 0
mirror of synced 2024-09-15 00:38:01 +12:00

Improve loading state

This commit is contained in:
Andrew Kingston 2023-03-08 10:49:52 +00:00
parent 856f0eb844
commit 7f263e9870

View file

@ -67,7 +67,7 @@
context = { ...context, ...createMenuStores(context) } context = { ...context, ...createMenuStores(context) }
// Reference some stores for local use // Reference some stores for local use
const { isResizing, isReordering, ui } = context const { isResizing, isReordering, ui, loaded } = context
// Keep config store up to date // Keep config store up to date
$: config.set({ $: config.set({
@ -84,6 +84,10 @@
// Expose ability to retrieve context externally to allow sheet control // Expose ability to retrieve context externally to allow sheet control
export const getContext = () => context export const getContext = () => context
// Local flag for if the sheet has ever had data
let initialised = false
loaded.subscribe(state => (initialised = initialised || state))
// Initialise websocket for multi-user // Initialise websocket for multi-user
onMount(() => createWebsocket(context)) onMount(() => createWebsocket(context))
</script> </script>
@ -105,16 +109,18 @@
<UserAvatars /> <UserAvatars />
</div> </div>
</div> </div>
<div class="sheet-data"> {#if initialised}
<StickyColumn /> <div class="sheet-data">
<div class="sheet-main"> <StickyColumn />
<HeaderRow /> <div class="sheet-main">
<SheetBody /> <HeaderRow />
<SheetBody />
</div>
<ResizeOverlay />
<ScrollOverlay />
<MenuOverlay />
</div> </div>
<ResizeOverlay /> {/if}
<ScrollOverlay />
<MenuOverlay />
</div>
<KeyboardManager /> <KeyboardManager />
</div> </div>