Skip to content

fix: silence double toasts in Loras/media custom-catch sites (#2669)#2723

Merged
atomantic merged 1 commit into
mainfrom
claim/issue-2669
Jul 17, 2026
Merged

fix: silence double toasts in Loras/media custom-catch sites (#2669)#2723
atomantic merged 1 commit into
mainfrom
claim/issue-2669

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

One batch of the #2669 sweep: Loras / media. Picked because it was the largest coherent remaining area that avoids the files reserved by concurrent work.

The rule applied (from the issue): a site gets { silent: true } when the call reaches the auto-toasting request() and the caller already owns its own error UI in .catch. Sites without their own error UI keep the single default helper layer.

6 sites changed across 2 files, plus a backward-compatible trailing options param threaded into 6 apiImageVideo.js wrappers (listLorasFull, getCivitaiSuggestions, deleteLoraFull, setCivitaiAuth, clearCivitaiAuth, listCachedModels).

  • Loras.jsx (5) — Civitai suggestions refresh, LoRA delete, Civitai key save, Civitai key clear (all custom toast.error), plus the LoRA list load.
  • MediaModels.jsx (1) — the cached-models list load.

A note on the two list-load sites

listLorasFull and listCachedModels catch into setError, which renders a persistent inline error panel (a <Banner tone="error"> / full error state) rather than a toast — so they double-report without matching a toast.error-in-.catch grep. Included them deliberately: silencing leaves the panel, which is the better of the two surfaces, and this is not a toast-less swallow (those correctly keep the single default layer and were left alone).

This isn't a new interpretation — MediaModels.handleAddFromHf already ships as addMediaModelFromHf({ url, silent: true }) paired with a setAddError catch. The two list loads were simply missed by the same sweep.

Verified-clean, no change needed

The issue's "Remaining" list called for ~9 sites here; most were already swept or are false positives. Each was checked by reading the call chain out to request():

  • MusicVideo.jsx, MediaJobsQueue.jsx, MediaModels.jsx (mutations), ImageGen.jsx — already pass silent at every custom-catch site.
  • removeImageWatermark / regenerateGalleryImage — hardcoded silent: true in the wrapper; the ImageGen.jsx toasts are already the only layer. Same for searchCivitaiLoras (silent = true default), which is the Loras Civitai-search toast.
  • ImageClean.jsxcleanImage / fetchCleanResult use raw fetch, never request(), so nothing auto-toasts. saveCleanResult already passes silent.
  • Toast-less swallows (getCivitaiAuth().catch(() => {}), listMediaModelRegistry().catch(() => {}), deleteImage(...).catch(() => {}), listMediaJobs(...).catch(() => null)) — left alone per the rule.

Test plan

  • cd client && npm test403 files / 4387 tests passed, 0 failures (no flakes this run).
  • Grepped for tests asserting exact call args on the six touched wrappers: only useUniverseDraft.test.jsx references one (listLorasFull), as a bare vi.fn() mock with no argument assertions. All six params default to {}, so every existing caller is unaffected.

Remaining

Out-of-batch. Counts are from the issue's last scan and are not individually wrapper-verified — the stale-list problem has bitten three batches now, so re-scan before trusting them:

  • Creative Director (~3)CreativeDirector.jsx:180, PlanTab.jsx:91/103/113, OverviewTab.jsx:148
  • Misc singles (~5)CatalogCastPanel, GmailMboxImportPanel, LocalLlmTab, MessageDetail, GenomeTab, PipelineManuscriptEditor
  • ManuscriptCommentCard.jsx:247,251generatePipelineManuscriptFix still needs an options param

Already shipped, do not re-sweep: settings + JIRA (#2670), messages/calendar/sharing, pipeline stages/canvas (#2714), writers-room/universe/universeBuilder/digital-twin/media pages/hooks (#2682), apps/GitHub/misc (#2721), and now Loras/media.

Refs #2669

The LoRAs and Media Models pages surfaced the same failure twice: once from
request()'s default toast and again from the caller's own .catch — either a
custom toast or a persistent inline error panel.

Threads a backward-compatible trailing `options` into the six affected
apiImageVideo wrappers and passes `{ silent: true }` at each custom-catch
site, so exactly one layer reports the failure.

Refs #2669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant