From 505da03c331159313d66e82cebc8278dc81d0b39 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Mon, 12 May 2025 21:34:41 +0200 Subject: [PATCH] switch handle login to $effect --- src/routes/contact/+page.svelte | 49 +++++++++++++++++---------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/routes/contact/+page.svelte b/src/routes/contact/+page.svelte index f71ac31..315073a 100644 --- a/src/routes/contact/+page.svelte +++ b/src/routes/contact/+page.svelte @@ -24,18 +24,18 @@ activeTab = 'write'; } - let subject = ''; - let content = ''; - let isSubmitting = false; - let showLoginModal = false; - let submissionSuccess = false; - let submissionError = ''; - let submittedEvent: NDKEvent | null = null; - let issueLink = ''; - let successfulRelays: string[] = []; - let isExpanded = false; - let activeTab = 'write'; - let showConfirmDialog = false; + let subject = $state(''); + let content = $state(''); + let isSubmitting = $state(false); + let showLoginModal = $state(false); + let submissionSuccess = $state(false); + let submissionError = $state(''); + let submittedEvent = $state(null); + let issueLink = $state(''); + let successfulRelays = $state([]); + let isExpanded = $state(false); + let activeTab = $state('write'); + let showConfirmDialog = $state(false); // Store form data when user needs to login let savedFormData = { @@ -256,16 +256,19 @@ } // Handle login completion - $: if ($ndkSignedIn && showLoginModal) { - showLoginModal = false; - - // Restore saved form data - if (savedFormData.subject) subject = savedFormData.subject; - if (savedFormData.content) content = savedFormData.content; - - // Submit the issue - submitIssue(); - } + $effect(() => { + if ($ndkSignedIn && showLoginModal) { + showLoginModal = false; + + // Restore saved form data + if (savedFormData.subject) subject = savedFormData.subject; + if (savedFormData.content) content = savedFormData.content; + + // Submit the issue + submitIssue(); + } + }); +
@@ -286,7 +289,7 @@ If you are logged into the Alexandria web application (using the button at the top-right of the window), then you can use the form, below, to submit an issue, that will appear on our repo page.

-
+