fix(web/claw): render and download the images a turn hands over
ci / checks (push) Successful in 1m13s
android / debug (push) Successful in 2m17s
android / release (push) Successful in 2m13s
ci / test (push) Successful in 42s
ci / chart (push) Successful in 5s
ci / docker (push) Successful in 1m52s
ci / web (push) Successful in 12s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 1m57s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 13s
ci / publish-edge-chart (push) Successful in 3s
ci / checks (push) Successful in 1m13s
android / debug (push) Successful in 2m17s
android / release (push) Successful in 2m13s
ci / test (push) Successful in 42s
ci / chart (push) Successful in 5s
ci / docker (push) Successful in 1m52s
ci / web (push) Successful in 12s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 1m57s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 13s
ci / publish-edge-chart (push) Successful in 3s
An attachment card lands inside the turn that produced it, and both passes that touch image cards scanned only the top-level rows. The pass that fetches bytes never saw the card, so it stayed a name and a size with no picture. The pass that stores the fetched object URL had the same blind spot, so even a fetch that ran dropped its result. Both now walk finished turns and the live one, through one helper that knows where cards live. Consents move to the same helper: a card whose turn already closed had the same problem. The download control was hidden for `media: "image"`, which left an image with no way out of the store when its bytes did not paint, as they never did. Every card offers it now. The anchor also joins the document for the click, which some browsers require before they follow a `download` on a blob URL.
This commit is contained in:
1 parent
1a1ace014a
commit
04b06e7623
4 files changed
+83
-67
No files matched your search
@@ -409,21 +409,29 @@ export function useTranscript() {
|
||||
if (pending !== -1) pendingSent.splice(pending, 1)
|
||||
}
|
||||
|
||||
/** A consent card resolved: flipped in place, or ignored when no
|
||||
* card carries the id. The in-flight turn's entries hold the cards a
|
||||
* running turn asked for; finished turns keep their own copies. */
|
||||
function resolveConsent(id: string, granted: boolean): void {
|
||||
if (live.value) {
|
||||
for (const entry of live.value.entries) {
|
||||
if (entry.kind === 'consent' && entry.consent.id === id) {
|
||||
entry.consent.granted = granted
|
||||
return
|
||||
}
|
||||
/** The cards on the mirror, at either depth. A card lands in the open
|
||||
* turn's entries and rides into the finished turn with it, so a scan
|
||||
* of the top-level rows alone misses everything a turn handed over.
|
||||
* The returned objects are the mirror's own, not copies: flipping one
|
||||
* flips what the panel renders. */
|
||||
function cards(): TurnEntry[] {
|
||||
const found: TurnEntry[] = [...(live.value?.entries ?? [])]
|
||||
for (const item of items.value) {
|
||||
if (item.kind === 'consent' || item.kind === 'attachment') {
|
||||
found.push(item)
|
||||
} else if (item.kind === 'turn') {
|
||||
found.push(...item.turn.entries)
|
||||
}
|
||||
}
|
||||
for (const item of items.value) {
|
||||
if (item.kind === 'consent' && item.consent.id === id) {
|
||||
item.consent.granted = granted
|
||||
return found
|
||||
}
|
||||
|
||||
/** A consent card resolved: flipped in place, or ignored when no
|
||||
* card carries the id. */
|
||||
function resolveConsent(id: string, granted: boolean): void {
|
||||
for (const card of cards()) {
|
||||
if (card.kind === 'consent' && card.consent.id === id) {
|
||||
card.consent.granted = granted
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -432,17 +440,9 @@ export function useTranscript() {
|
||||
/** An attachment's object URL landed; stored on its card. The useClaw
|
||||
* cache keeps a reconnect's replay from refetching the bytes. */
|
||||
function setAttachmentUrl(id: string, url: string): void {
|
||||
if (live.value) {
|
||||
for (const entry of live.value.entries) {
|
||||
if (entry.kind === 'attachment' && entry.attachment.id === id) {
|
||||
entry.attachment.url = url
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const item of items.value) {
|
||||
if (item.kind === 'attachment' && item.attachment.id === id) {
|
||||
item.attachment.url = url
|
||||
for (const card of cards()) {
|
||||
if (card.kind === 'attachment' && card.attachment.id === id) {
|
||||
card.attachment.url = url
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -466,16 +466,12 @@ export function useTranscript() {
|
||||
/** Whether a card for this consent id is already on the mirror — a
|
||||
* replayed request never stacks a second card beside the first. */
|
||||
function findConsent(id: string): boolean {
|
||||
if (live.value?.entries.some((e) => e.kind === 'consent' && e.consent.id === id)) return true
|
||||
return items.value.some((item) => item.kind === 'consent' && item.consent.id === id)
|
||||
return cards().some((card) => card.kind === 'consent' && card.consent.id === id)
|
||||
}
|
||||
|
||||
/** Whether a card for this attachment id is already on the mirror. */
|
||||
function findAttachment(id: string): boolean {
|
||||
if (live.value?.entries.some((e) => e.kind === 'attachment' && e.attachment.id === id)) {
|
||||
return true
|
||||
}
|
||||
return items.value.some((item) => item.kind === 'attachment' && item.attachment.id === id)
|
||||
return cards().some((card) => card.kind === 'attachment' && card.attachment.id === id)
|
||||
}
|
||||
|
||||
/** Reads one page of older turns (whole turns, oldest first) and
|
||||
|
||||
Reference in new issue
Block a user