From 2da28854a0a817d9ae857d47e43843cbad830463 Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Tue, 10 Dec 2024 14:39:57 -0500 Subject: [PATCH] Prefill afterNavigate --- src/lib/components/forms/AddOnDispatch.svelte | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/components/forms/AddOnDispatch.svelte b/src/lib/components/forms/AddOnDispatch.svelte index 67765bc9..57d65c28 100644 --- a/src/lib/components/forms/AddOnDispatch.svelte +++ b/src/lib/components/forms/AddOnDispatch.svelte @@ -52,12 +52,6 @@ $: validator = ajv.compile({ type: "object", properties, required }); $: hasEvents = eventOptions && eventOptions.events.length > 0; $: hasFields = Object.keys(properties).length > 0; - // prefill values from search params - $: new URLSearchParams($page.url.searchParams).forEach((v, k) => { - if (k in properties) { - $values[k] = v; - } - }); afterNavigate(() => { // set initial values @@ -67,6 +61,12 @@ event: schedules[event.event], }; } + // prefill values from search params + new URLSearchParams($page.url.searchParams).forEach((v, k) => { + if (k in properties) { + $values[k] = v; + } + }); }); function objectify(params: any) {