From 436ced8dd74101e8f082c1834ee3d9530bc3c34e Mon Sep 17 00:00:00 2001 From: Bhavishy Date: Tue, 7 Apr 2026 23:19:20 +0530 Subject: [PATCH] fix: show deep-link action errors with abort-or-continue flow --- src/app/components/IntentHandler.svelte | 132 +++++++++++++++--------- 1 file changed, 83 insertions(+), 49 deletions(-) diff --git a/src/app/components/IntentHandler.svelte b/src/app/components/IntentHandler.svelte index 8ce3a763..c598ae35 100644 --- a/src/app/components/IntentHandler.svelte +++ b/src/app/components/IntentHandler.svelte @@ -79,6 +79,7 @@ const hasShare = !!shareRelay && !!shareH let processing = $state(false) + let errors = $state([]) onMount(() => { if (!hasSettings) { @@ -99,6 +100,10 @@ const accept = async () => { processing = true + errors = [] + + const nextErrors: string[] = [] + try { if (t) { theme.set(t) @@ -106,8 +111,16 @@ if (relays.length > 0) { for (const url of relays) { - addRelay(url, RelayMode.Read) - addRelay(url, RelayMode.Write) + const readError = await waitForThunkError(await addRelay(url, RelayMode.Read)) + const writeError = await waitForThunkError(await addRelay(url, RelayMode.Write)) + + if (readError) { + nextErrors.push(`Relay ${url} (read): ${errorMessage(readError)}`) + } + + if (writeError) { + nextErrors.push(`Relay ${url} (write): ${errorMessage(writeError)}`) + } } } @@ -122,11 +135,7 @@ ) if (error) { - pushToast({ - theme: "error", - message: `Failed to update blossom servers: ${errorMessage(error)}`, - }) - return + nextErrors.push(`Blossom servers: ${errorMessage(error)}`) } } @@ -141,14 +150,17 @@ ) if (error) { - pushToast({theme: "error", message: `Failed to update follows: ${errorMessage(error)}`}) - return + nextErrors.push(`Follows: ${errorMessage(error)}`) } } if (joins.length > 0) { for (const url of joins) { - await addSpaceMembership(url) + const error = await waitForThunkError(await addSpaceMembership(url)) + + if (error) { + nextErrors.push(`Join ${url}: ${errorMessage(error)}`) + } } } @@ -164,17 +176,15 @@ const error = await waitForThunkError(updateProfile({profile, shouldBroadcast: true})) if (error) { - if (error.includes("rate-limited") || error.startsWith("blocked:")) { - pushToast({ - message: "Profile update was requested, but one relay rate-limited or blocked it.", - }) - } else { - pushToast({theme: "error", message: `Failed to update profile: ${errorMessage(error)}`}) - return - } + nextErrors.push(`Profile: ${errorMessage(error)}`) } } + if (nextErrors.length > 0) { + errors = nextErrors + return + } + pushToast({message: "Customizations Applied!"}) if (hasShare) { @@ -186,6 +196,16 @@ processing = false } } + + const continueWithErrors = async () => { + pushToast({message: "Applied what we could. Some actions failed."}) + + if (hasShare) { + await openShare() + } else { + back() + } + } {#if hasSettings} @@ -199,40 +219,54 @@ -

This link will apply the following changes:

-
    - {#if t} -
  • Set theme to "{t}"
  • - {/if} - {#if relays.length > 0} -
  • Add {relays.length} relay{relays.length > 1 ? "s" : ""} to your settings
  • - {/if} - {#if blossoms.length > 0} -
  • Add {blossoms.length} blossom server{blossoms.length > 1 ? "s" : ""}
  • - {/if} - {#if follows.length > 0} -
  • Follow {follows.length} person{follows.length > 1 ? "s" : ""}
  • - {/if} - {#if joins.length > 0} -
  • Join {joins.length} communit{joins.length > 1 ? "ies" : "y"}
  • - {/if} - {#if hasProfile} -
  • Update your profile metadata
  • - {/if} - {#if hasShare} -
  • Open a new post dialog in a specific room
  • - {/if} -
+ {#if errors.length === 0} +

This link will apply the following changes:

+
    + {#if t} +
  • Set theme to "{t}"
  • + {/if} + {#if relays.length > 0} +
  • Add {relays.length} relay{relays.length > 1 ? "s" : ""} to your settings
  • + {/if} + {#if blossoms.length > 0} +
  • Add {blossoms.length} blossom server{blossoms.length > 1 ? "s" : ""}
  • + {/if} + {#if follows.length > 0} +
  • Follow {follows.length} person{follows.length > 1 ? "s" : ""}
  • + {/if} + {#if joins.length > 0} +
  • Join {joins.length} communit{joins.length > 1 ? "ies" : "y"}
  • + {/if} + {#if hasProfile} +
  • Update your profile metadata
  • + {/if} + {#if hasShare} +
  • Open a new post dialog in a specific room
  • + {/if} +
+ {:else} +

Some actions failed. You can abort or continue with successful actions only.

+
    + {#each errors as error} +
  • {error}
  • + {/each} +
+ {/if}
- - + {#if errors.length === 0} + + + {:else} + + + {/if}