Skip to content

Commit

Permalink
Let scheme forms finalize
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Oct 30, 2024
1 parent 5581050 commit 82ce8b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export interface Config<F, S> {
}>
>;

// This component will only be instantiated when the user opens the modal to
// edit the scheme, so it can rely on onDestroy to finalize any
// changes.
editSchemeForm: null | ComponentType<
SvelteComponent<{
gjSchemes: Writable<Schemes<F, S>>;
Expand Down
8 changes: 7 additions & 1 deletion src/lib/sidebar/PerSchemeControls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,13 @@
{/if}

<Modal title="Edit scheme" bind:open={showEditModal}>
<svelte:component this={cfg.editSchemeForm} {gjSchemes} {scheme_reference} />
{#if showEditModal}
<svelte:component
this={cfg.editSchemeForm}
{gjSchemes}
{scheme_reference}
/>
{/if}

<ButtonGroup>
<DefaultButton on:click={() => (showEditModal = false)}>
Expand Down

0 comments on commit 82ce8b7

Please sign in to comment.