Wait for thunk errors

This commit is contained in:
Jon Staab
2025-09-05 17:32:01 -07:00
committed by hodlbod
parent 7217d122b5
commit 998c48b1d3
5 changed files with 14 additions and 11 deletions
@@ -15,7 +15,7 @@
ROOM_ADD_USER,
ROOM_REMOVE_USER,
} from "@welshman/util"
import {pubkey, publishThunk, getThunkError, joinRoom, leaveRoom} from "@welshman/app"
import {pubkey, publishThunk, waitForThunkError, joinRoom, leaveRoom} from "@welshman/app"
import {slide, fade, fly} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
@@ -69,7 +69,7 @@
joining = true
try {
const message = await getThunkError(joinRoom(url, makeRoomMeta({id: room})))
const message = await waitForThunkError(joinRoom(url, makeRoomMeta({id: room})))
if (message && !message.startsWith("duplicate:")) {
return pushToast({theme: "error", message})
@@ -85,7 +85,7 @@
const leave = async () => {
leaving = true
try {
const message = await getThunkError(leaveRoom(url, makeRoomMeta({id: room})))
const message = await waitForThunkError(leaveRoom(url, makeRoomMeta({id: room})))
if (message && !message.startsWith("duplicate:")) {
pushToast({theme: "error", message})