Skip to content

Commit

Permalink
Fix layout object references
Browse files Browse the repository at this point in the history
Delay referencing SAB-specific components didn't work in SAB!
  • Loading branch information
chrisvire committed Nov 19, 2024
1 parent ae17f95 commit c6d6958
Showing 1 changed file with 6 additions and 24 deletions.
30 changes: 6 additions & 24 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import FontSelector from '$lib/components/FontSelector.svelte';
import Sidebar from '$lib/components/Sidebar.svelte';
import TextAppearanceSelector from '$lib/components/TextAppearanceSelector.svelte';
import NoteDialog from '$lib/components/NoteDialog.svelte';
import CollectionSelector from '$lib/components/CollectionSelector.svelte';
import catalog from '$lib/data/catalogData';
import config from '$lib/data/config';
import {
Expand All @@ -22,18 +24,6 @@
const isSAB = config.programType == 'SAB';
// Delay import components only used in SAB
let NoteDialog;
let CollectionSelector;
if (isSAB) {
import('$lib/components/NoteDialog.svelte').then((module) => {
NoteDialog = module;
});
import('$lib/components/CollectionSelector.svelte').then((module) => {
CollectionSelector = module;
});
}
if (isSAB && !$refs.initialized) {
catalog.setFetch(fetch);
// When this async function completes, $refs.intialized will be true.
Expand Down Expand Up @@ -93,19 +83,11 @@
<!--Div containing the popup modals triggered by the navBar buttons and SideBar entries -->

{#if isSAB}
{#if NoteDialog}
<!-- Add Note Menu -->
<svelte:component this={NoteDialog} bind:this={noteDialog} />
{/if}
<!-- Add Note Menu -->
<NoteDialog bind:this={noteDialog} />

{#if CollectionSelector}
<!-- Collection Selector Menu -->
<svelte:component
this={CollectionSelector}
bind:this={collectionSelector}
vertOffset={NAVBAR_HEIGHT}
/>
{/if}
<!-- Collection Selector Menu -->
<CollectionSelector bind:this={collectionSelector} vertOffset={NAVBAR_HEIGHT} />
{/if}

<!-- Text Appearance Options Menu -->
Expand Down

0 comments on commit c6d6958

Please sign in to comment.