diff --git a/src/app/components/RoomItem.svelte b/src/app/components/RoomItem.svelte index 1cf4623c..87c49c10 100644 --- a/src/app/components/RoomItem.svelte +++ b/src/app/components/RoomItem.svelte @@ -127,7 +127,7 @@
{#if thunk} - + {/if}
diff --git a/src/app/components/ThunkFailure.svelte b/src/app/components/ThunkFailure.svelte index c09186e3..cc367242 100644 --- a/src/app/components/ThunkFailure.svelte +++ b/src/app/components/ThunkFailure.svelte @@ -2,7 +2,7 @@ import {stopPropagation} from "svelte/legacy" import {noop} from "@welshman/lib" import type {AbstractThunk} from "@welshman/app" - import {retryThunk, thunkIsComplete, getFailedThunkUrls} from "@welshman/app" + import {flattenThunks, getFailedThunkUrls, publishThunk, thunkIsComplete} from "@welshman/app" import Danger from "@assets/icons/danger-triangle.svg?dataurl" import Icon from "@lib/components/Icon.svelte" import Tippy from "@lib/components/Tippy.svelte" @@ -16,40 +16,45 @@ class?: string } - let {thunk, showToastOnRetry, ...restProps}: Props = $props() + const {thunk, showToastOnRetry, ...restProps}: Props = $props() - const retry = () => { - thunk = retryThunk(thunk) + const showFailure = $derived(thunkIsComplete($thunk) && getFailedThunkUrls($thunk).length > 0) - if (showToastOnRetry) { - pushToast({ - timeout: 30_000, - children: { - component: ThunkToast, - props: {thunk}, - }, - }) + const retry = (url: string) => { + for (const child of flattenThunks([thunk])) { + if (!child.options.relays.includes(url)) { + continue + } + + const retried = publishThunk({...child.options, relays: [url]}) + + if (showToastOnRetry) { + pushToast({ + timeout: 30_000, + children: { + component: ThunkToast, + props: {thunk: retried}, + }, + }) + } + + return } } - - const failedUrls = $derived(getFailedThunkUrls($thunk)) - const showFailure = $derived(thunkIsComplete($thunk) && failedUrls.length > 0) {#if showFailure} - {@const url = failedUrls[0]} - {@const {status, detail: message} = $thunk.results[url]} +
+ + + {title} + +
+
+ {#each successUrls as url (url)} +
+ + {displayRelayUrl(url)} +
+ {/each} + {#each failedUrls as url (url)} + {@const {detail, status} = $thunk.results[url] || {}} +
+ +
+

{displayRelayUrl(url)}

+

{addPeriod(relayMessage(status, detail))}

+
+ +
+ {/each} +