Upgrade to welshman 0.11.0

This commit is contained in:
Coracle-Bot 2026-09-21 17:58:14 +00:00
parent 7cb3feeeb3
commit 6b5947ae0e
29 changed files with 48 additions and 43 deletions

View file

@ -314,7 +314,7 @@ data every page needs lives in `src/app/sync.ts`.
**One entity, or a handful of lists:** call plugin `load` in `onMount`, and toast on failure, as
`people/[npub]/+page.svelte` does for the profile, relay list, follow, pin, room and messaging
lists before loading the author's outbox with `$network.load`.
lists before loading the author's outbox with `$network.loadLenient`.
**A detail page:** `deriveEvent(address, [url])` loads when nothing local matches. While it is
empty, seven pages show a spinner that turns into a failure message:

View file

@ -91,16 +91,16 @@
"@types/throttle-debounce": "^5.0.2",
"@vite-pwa/assets-generator": "^1.0.2",
"@vite-pwa/sveltekit": "^1.1.0",
"@welshman/app": "^0.10.9",
"@welshman/content": "^0.10.9",
"@welshman/domain": "^0.10.9",
"@welshman/editor": "^0.10.9",
"@welshman/feeds": "^0.10.9",
"@welshman/lib": "^0.10.9",
"@welshman/net": "^0.10.9",
"@welshman/signer": "^0.10.9",
"@welshman/store": "^0.10.9",
"@welshman/util": "^0.10.9",
"@welshman/app": "^0.11.0",
"@welshman/content": "^0.11.0",
"@welshman/domain": "^0.11.0",
"@welshman/editor": "^0.11.0",
"@welshman/feeds": "^0.11.0",
"@welshman/lib": "^0.11.0",
"@welshman/net": "^0.11.0",
"@welshman/signer": "^0.11.0",
"@welshman/store": "^0.11.0",
"@welshman/util": "^0.11.0",
"cheerio": "^1.2.0",
"compressorjs-next": "^1.1.2",
"dompurify": "^3.4.13",

Binary file not shown.

View file

@ -336,7 +336,7 @@ export const toggleVideoPrimaryTile = (key: string) => {
}
export const loadCallParticipants = (url: string, h: string) =>
network.get().load({
network.get().loadLenient({
relays: [url],
filters: [{kinds: [LIVEKIT_PARTICIPANTS], "#d": [h]}],
})

View file

@ -48,15 +48,16 @@ export class Commands extends RelayScopedDerivedPlugin<CommandReader> {
const [url, address] = splitCommandKey(key)
const {pubkey, identifier} = Address.from(address)
return this.app
.use(Network)
.load({relays: [url], filters: [{kinds: [COMMAND], authors: [pubkey], "#d": [identifier]}]})
return this.app.use(Network).loadComplete({
relays: [url],
filters: [{kinds: [COMMAND], authors: [pubkey], "#d": [identifier]}],
})
}
ensureLoaded = (url: string) => {
if (!this.pulled.has(url)) {
this.pulled.add(url)
this.app.use(Network).load({relays: [url], filters: [{kinds: [COMMAND]}]})
this.app.use(Network).loadLenient({relays: [url], filters: [{kinds: [COMMAND]}]})
}
}

View file

@ -127,7 +127,7 @@
history.back()
if (shareToChat) {
publishRoomQuote({url, h, parent: calendarThunk.event, protect})
publishRoomQuote({url, h, parent: calendarThunk.options.event, protect})
}
pushToast({message: "Your event has been saved!"})

View file

@ -40,7 +40,7 @@
const isOwn = event.pubkey === $user.pubkey
const profileDisplay = $profiles.display(event.pubkey).$
const thunks = $app.use(Thunks).history
const thunk = $app.use(Thunks).merge($thunks.filter(t => t.event.id === event.id))
const thunk = $app.use(Thunks).merge($thunks.filter(t => t.options.event.id === event.id))
const colorValue = colorFor(event.pubkey)
const reply = () => replyTo(event)

View file

@ -129,7 +129,7 @@
history.back()
if (shareToChat) {
publishRoomQuote({url, h, parent: classifiedThunk.event, protect})
publishRoomQuote({url, h, parent: classifiedThunk.options.event, protect})
}
} finally {
loading = false

View file

@ -56,7 +56,7 @@
mergedRelays.set(urls)
if (!$quote) {
$network.load({filters: getIdFilters([idOrAddress]), relays: urls})
$network.loadLenient({filters: getIdFilters([idOrAddress]), relays: urls})
}
})

View file

@ -104,7 +104,7 @@
history.back()
if (shareToChat) {
publishRoomQuote({url, h, parent: goalThunk.event, protect})
publishRoomQuote({url, h, parent: goalThunk.options.event, protect})
}
} finally {
loading = false

View file

@ -53,7 +53,7 @@
back()
} else {
pushToast({message: "Shelf created!"})
navigate(makeLibraryPath(url, getAddress(thunk.event)))
navigate(makeLibraryPath(url, getAddress(thunk.options.event)))
}
} catch (e) {
console.error(e)

View file

@ -156,7 +156,7 @@
history.back()
if (shareToChat) {
publishRoomQuote({url, h, parent: pollThunk.event, protect})
publishRoomQuote({url, h, parent: pollThunk.options.event, protect})
}
} finally {
loading = false

View file

@ -20,7 +20,7 @@
onDestroy(context.cleanup)
const events = $network.load({
const events = $network.loadComplete({
relays: [url],
filters: [{authors: [pubkey], kinds: [NOTE], limit}],
})

View file

@ -57,7 +57,7 @@
{/if}
<div class="card card-sm">
{#if etag}
{#await $network.load({relays: [url, LOCAL_RELAY_URL], filters: getIdFilters([etag[1]])})}
{#await $network.loadComplete( {relays: [url, LOCAL_RELAY_URL], filters: getIdFilters( [etag[1]], )}, )}
<p>Loading</p>
{:then reportedEvents}
{#if reportedEvents.length === 0}

View file

@ -58,7 +58,7 @@
const message = await thunk.waitForError()
if (message) {
$app.repository.removeEvent(thunk.event.id)
$app.repository.removeEvent(thunk.options.event.id)
pushToast({theme: "error", message})
} else {
await $roomLists.removeRoom(h, url).then(publish)

View file

@ -57,7 +57,7 @@
)
try {
const events = await $network.load({relays, filters, signal: controller.signal})
const events = await $network.loadComplete({relays, filters, signal: controller.signal})
results = sortEventsDesc(uniqBy((e: TrustedEvent) => e.id, [...events, ...results]))
} catch (error) {

View file

@ -96,7 +96,7 @@
history.back()
if (shareToChat) {
publishRoomQuote({url, h: room, parent: thunk.event, protect})
publishRoomQuote({url, h: room, parent: thunk.options.event, protect})
}
} finally {
loading = false

View file

@ -23,7 +23,11 @@
const retry = (url: string) => {
for (const child of $thunks.flatten([thunk])) {
if (child.options.relays.includes(url)) {
const retried = $thunks.publish({...child.options, event: child.event, relays: [url]})
const retried = $thunks.publish({
...child.options,
event: child.options.event,
relays: [url],
})
if (showToastOnRetry) {
pushToast({

View file

@ -74,7 +74,7 @@
const {relays, invoice, filters} = await requestInvoice()
await payInvoice(invoice)
await $network.load({relays, filters})
await $network.loadLenient({relays, filters})
pushToast({message: "Zap successfully sent!"})
back()

View file

@ -146,7 +146,7 @@ export const makeFeedContext = ({
}
const loadFrom = async (urls: string[], events: TrustedEvent[]) => {
const context = await network.get().load({
const context = await network.get().loadComplete({
relays: urls,
signal: controller.signal,
filters: [
@ -156,7 +156,7 @@ export const makeFeedContext = ({
})
if (context.length > 0) {
network.get().load({
network.get().loadLenient({
relays: urls,
signal: controller.signal,
filters: getReplyFilters(context, {kinds: [DELETE]}),

View file

@ -19,7 +19,7 @@ export const derivePinnedEvents = (pubkey: string): Readable<TrustedEvent[]> =>
.get()
.resolver.relays([outbox(pubkey)])
.then($relays =>
network.get().load({relays: $relays, filters, signal: controller.signal}),
network.get().loadLenient({relays: $relays, filters, signal: controller.signal}),
)
const unsubscribe = deriveEvents(filters).subscribe(set)

View file

@ -16,7 +16,7 @@ export const deriveEvent = (idOrAddress: string, relays: string[] = []) =>
repository: $app.repository,
includeDeleted: true,
onDerive: (filters: Filter[], hints: string[]) =>
$app.use(Network).load({filters, relays: hints}),
$app.use(Network).loadLenient({filters, relays: hints}),
})(idOrAddress, relays),
)

View file

@ -22,7 +22,7 @@ export const deriveRoomPinnedEvents = (url: string, h: string): Readable<Trusted
const filters = getIdFilters($pins)
network.get().load({relays: [url], filters, signal: controller.signal})
network.get().loadLenient({relays: [url], filters, signal: controller.signal})
return deriveEventsForUrl(url, filters).subscribe($events => {
const byPin = new Map(

View file

@ -224,7 +224,7 @@ const syncUserData = () => {
if (authors.length > 0) {
const scenario = await router.get().resolve(authors.map(author => outbox(author)))
network.get().load({
network.get().loadLenient({
filters: [{kinds: [FOLLOWS, MUTES], authors}],
relays: scenario.limit(8).getUrls(),
})
@ -295,7 +295,7 @@ const syncSpace = (url: string) => {
// Which sections a space offers is a question about its whole history rather than about the
// recent window above — a space whose newest poll is a year old still has polls. One event
// per kind answers it.
network.get().load({
network.get().loadLenient({
relays: [url],
signal: controller.signal,
filters: CONTENT_KINDS.map(kind => ({kinds: [kind], limit: 1})),

View file

@ -17,7 +17,7 @@ export const thunksByEventId = derived(
const byId = new Map<string, Thunk[]>()
for (const thunk of $history) {
pushToMapKey(byId, thunk.event.id, thunk)
pushToMapKey(byId, thunk.options.event.id, thunk)
}
// Hand back the array from last time wherever an event's thunks are unchanged. A row derives

View file

@ -30,7 +30,7 @@
let found = false
$network.load({
$network.loadComplete({
relays: [LOCAL_RELAY_URL, ...data.relays],
filters: getIdFilters([type === "nevent" ? data.id : Address.fromNaddr(bech32).toString()]),
onEvent: (event: TrustedEvent) => {

View file

@ -57,7 +57,7 @@
filters.push({kinds: [FOLLOWS], "#p": [pubkey], limit: 500})
}
$network.load({
$network.loadLenient({
relays: await $router.resolver.relays([outbox(pubkey)]),
filters,
})

View file

@ -145,10 +145,10 @@
}
draftKey.clear()
goto(makeArticlePath(url, getAddress(thunk.event)))
goto(makeArticlePath(url, getAddress(thunk.options.event)))
if (shareToChat) {
publishRoomQuote({url, h, parent: thunk.event, protect})
publishRoomQuote({url, h, parent: thunk.options.event, protect})
}
} finally {
loading = false

View file

@ -72,7 +72,7 @@
const controller = new AbortController()
$network
.load({relays: [url], filters: [{kinds: [PINBOARD, PIN]}], signal: controller.signal})
.loadLenient({relays: [url], filters: [{kinds: [PINBOARD, PIN]}], signal: controller.signal})
.then(() => {
loading = false
})