fix(out): 角标空指针(视图未命中时 ingSt 为 null)+ 未落地优先于下载中

This commit is contained in:
qiqi committed 2026-12-02 20:09:54 +08:00
1 parent a6d4f5cc63
commit fce4fedad6
2 files changed
+9 -4

No files matched your search

+8 -3
View File
@@ -910,9 +910,14 @@
// 而结果又是远程 url,就说明还在从网络取图,直接标「下载中」,保证一定有可见反馈。
const _localSrc = (r && r.idb && r.data) ? r.data : ((r && r.url && outThumbCache.get(r.url)) || null)
const _remoteOnly = !_localSrc && !(ingSt && ingSt.localUrl) && /^https?:/i.test(String((r && r.url) || ''))
const ingBadge = (ingSt && (ingSt.status === 'queued' || ingSt.status === 'downloading')) || _remoteOnly
? el('span', { className: 'iwb-out-cell-flag', key: 'ing-flag' }, ingSt.status === 'queued' ? '排队中' : '下载中')
: (ingSt && ingSt.status === 'failed' ? el('span', { className: 'iwb-out-cell-flag iwb-out-cell-flag-err', key: 'ing-flag' }, '未落地') : null)
// 2026-12-02 修:先取安全状态再判 —— 之前或运算与三元混用,条件为真时仍解引用 ingSt.status,
// 视图没命中(ingSt=null)会抛 TypeError。优先级:未落地 > 排队中/下载中。
const ingStatus = ingSt ? ingSt.status : null
const ingBadge = (ingStatus === 'failed')
? el('span', { className: 'iwb-out-cell-flag iwb-out-cell-flag-err', key: 'ing-flag' }, '未落地')
: ((ingStatus === 'queued' || ingStatus === 'downloading' || _remoteOnly)
? el('span', { className: 'iwb-out-cell-flag', key: 'ing-flag' }, ingStatus === 'queued' ? '排队中' : '下载中')
: null)
return el('div', { key: String(r.url || '') + '|' + ri, className: 'iwb-out-cell' },
ingBadge,
DlOv ? el(DlOv, { key: 'ov', onDownload: doDownload, icon: I('download'), label: '下载' }, imgEl) : imgEl,