Commit 84b1c6e
fix: Media Assets group badge count to use previewable_outputs_count (#14347)
_Requested by **Alexis Rolland, Christian Byrne** · [Slack
thread](https://comfy-organization.slack.com/archives/C0A4XMHANP3/p1785382578658559?thread_ts=1785382578.658559&cid=C0A4XMHANP3)_
## Before
The Media Assets group badge on a job's stacked asset card reads
`outputs_count`, which counts every output item across every node for a
job regardless of file type. The expanded/drilldown view only ever
renders `task.previewableOutputs` (image, video, audio, 3D, text by
extension). Any job that also produces a non-previewable saved file
alongside real media — for example `SaveLatent`, which writes a
`.latent` file with no previewable extension or media type — gets that
file counted toward the badge but never shown when a user drills into
the group, so the badge shows a higher number than what's actually there
(matching the original report: badge says 3, expanding only shows 2).
## After
The badge now reads a new `previewable_outputs_count` field when the
backend provides it, computed server-side using the same
previewable-media definition the frontend's expanded view already
applies, so the count matches the drilldown for the common case.
## How
`src/platform/remote/comfyui/jobs/jobTypes.ts` adds
`previewable_outputs_count` to the job schema (same optional/nullable
shape as the existing `outputs_count`; this is a hand-written Zod schema
shared by both local ComfyUI and Cloud, not a generated client).
`src/stores/queueStore.ts` adds a `previewableOutputsCount` getter on
`TaskItemImpl` mirroring the existing `outputsCount` getter.
`src/stores/assetsStore.ts`'s `mapHistoryToAssets` now computes the
badge's `outputCount` as `task.previewableOutputsCount ??
task.outputsCount ?? task.previewableOutputs.length`, preferring the new
field, falling back to the old total when it's absent, and finally to
the existing client-side computation used today. Tests added/updated in
`assetsStore.test.ts` and `queueStore.test.ts` cover the getter and the
badge preferring the new field over the old one.
## Dependencies
This depends on two companion backend PRs adding
`previewable_outputs_count`, same field name and concept on both
distributions since local ComfyUI and Cloud both serve this frontend
through the same `/jobs` schema:
- Cloud: Comfy-Org/cloud#5857 (ingest API's
`JobEntry`/`JobDetailResponse`) — open, not merged as of 2026-08-09.
- Core/local ComfyUI: Comfy-Org/ComfyUI#15148
(`/api/jobs`) — open, not merged as of 2026-08-09.
Both are currently open (neither is a draft) and awaiting review/merge.
Until whichever backend a user is on ships its half, this frontend
change is inert and the badge keeps behaving exactly as it does today,
since the fallback chain covers the field's absence. On Comfy Cloud
specifically, the badge won't show corrected counts until #5857 merges
and deploys. For local ComfyUI, the badge already worked identically
before this change (`outputsCount ?? previewableOutputs.length`) and
continues to work identically once #15148 lands, since
`previewableOutputsCount` simply takes priority when present — no
regression either way for local users.
## Known cross-repo inconsistency (resolved)
Previously flagged here: `SaveText` saves its output under the `"files"`
media-type key with a real `.txt` filename, and this frontend
(`isPreviewableMediaType`/`isText`) and Core's `is_previewable()` both
treat that as previewable via a text-extension fallback, while Cloud's
`SupportsPreview()` (as of the initial #5857 draft) had no equivalent
text fallback — meaning a Cloud job with a `SaveText` output alongside
real media would under-count relative to the drilldown once
`previewable_outputs_count` shipped.
This is resolved: Cloud PR #5857 (merged) addresses it via
`isBadgePreviewable()`/`isCountablePreviewable()`, which explicitly
includes text, matching Core's `PREVIEWABLE_MEDIA_TYPES`. No cross-repo
inconsistency remains.
---
_Generated by [Claude Code](https://claude.ai/code)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Christian Byrne <cbyrne@comfy.org>1 parent 62ee999 commit 84b1c6e
7 files changed
Lines changed: 162 additions & 6 deletions
File tree
- browser_tests/tests/sidebar
- src
- platform/remote/comfyui/jobs
- stores
- workspace
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
96 | 141 | | |
97 | 142 | | |
98 | 143 | | |
99 | 144 | | |
100 | 145 | | |
101 | 146 | | |
102 | 147 | | |
103 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
104 | 151 | | |
105 | 152 | | |
106 | 153 | | |
| |||
283 | 330 | | |
284 | 331 | | |
285 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
286 | 358 | | |
287 | 359 | | |
288 | 360 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
66 | 73 | | |
67 | 74 | | |
68 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
| 130 | + | |
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| |||
648 | 650 | | |
649 | 651 | | |
650 | 652 | | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
651 | 680 | | |
652 | 681 | | |
653 | 682 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
283 | 318 | | |
284 | 319 | | |
285 | 320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
333 | 338 | | |
334 | 339 | | |
335 | 340 | | |
| |||
580 | 585 | | |
581 | 586 | | |
582 | 587 | | |
583 | | - | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
584 | 593 | | |
585 | 594 | | |
586 | 595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
0 commit comments