Skip to content

Commit

Permalink
Fix subtle race condition with initializing new feature props
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Nov 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 369badc commit 224ac17
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib/draw/NewFeatureForm.svelte
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<script lang="ts" generics="F, S">
import { type Config } from "$lib/config";
import { onDestroy, onMount } from "svelte";
import { onDestroy } from "svelte";
import type { Schemes } from "$lib/draw/types";
import type { Writable } from "svelte/store";
import { featureProps } from "./stores";
export let cfg: Config<F, S>;
export let gjSchemes: Writable<Schemes<F, S>>;
// Always start with blank properties
onMount(() => {
$featureProps = {};
});
// Always start with blank properties. Run this immediately, NOT in onMount,
// to avoid racing with anything done in the editFeatureForm component.
$featureProps = {};
onDestroy(() => {
$featureProps = {};
});

0 comments on commit 224ac17

Please sign in to comment.