fix: v3.26.179 无缩略图时直接显示原图(空 src 触发 onError 被永久标失效);onLoad 清除失效标记
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m49s

This commit is contained in:
qiqi committed 2026-12-01 21:20:31 +08:00
1 parent c3227ce0d5
commit 7ca372efec
6 files changed
+20 -10

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.26.178",
"version": "3.26.179",
"description": "Browser-based node canvas image workbench",
"scripts": {
"build": "node scripts/build.js && node scripts/copy-plugins.js",
+1 -1
View File
@@ -2014,7 +2014,7 @@ dependencies = [
[[package]]
name = "image-workbench"
version = "3.26.177"
version = "3.26.179"
dependencies = [
"arboard",
"base64 0.22.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.26.178"
version = "3.26.179"
description = "无限画布 · 生图工作台桌面版"
authors = ["malongan"]
license = ""
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "image-workbench",
"version": "3.26.178",
"version": "3.26.179",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
+5 -5
View File
@@ -66,11 +66,11 @@
// v3.26.172:小图还没生成时**最多占位 300ms**,超时就退回原图 ——
// 之前本地图无缩略图时一律返回空串,遇到「标注替换原图」这类新字节,
// 新 key 没有缓存、缩略图又生成失败/很慢时,节点就一直是空白(观感=图片丢了)。
if (/^https?:/i.test(orig0)) return orig0
const t0 = missAt.get(key)
if (t0 === undefined) missAt.set(key, Date.now())
else if (Date.now() - t0 > 300) return orig0
return thumb || ''
// v3.26.179:本地图没有缩略图时**直接返回原图**。
// 之前返回空串占位,<img src=""> 会触发 onError,节点体把它永久标成「图片源已失效」,
// 之后又没有重渲染去纠正 ⇒ 标注覆盖后看起来就是“图丢了”(且错误态反复重试吃 CPU)。
// 缩略图仍会在后台生成,就绪后由 bump 触发一次重渲染换小图。
return orig0 || thumb || ''
}
if (thumb && need <= ORIG_HARD_CAP) return thumb
const orig = (v && typeof v === 'object')
+11 -1
View File
@@ -717,7 +717,17 @@
return el('div', { className: 'iwb-node-body iwb-ref-body' },
hasImg
? el('div', { className: 'iwb-ref-show' },
el('img', { className: 'iwb-ref-single', decoding: 'async', fetchPriority: 'low', src: wPreviewUrlOf((typeof wImgSrcForNode === 'function' ? wImgSrcForNode : wDisplayThumbOf)(wThumbSrc(src), Math.min(320, (props.node && props.node.w) || 280))), alt: '图片', draggable: false, onLoad: (e) => { fitRefNodeOnce(e, props.node, onUpdate) }, onError: (e) => {
el('img', { className: 'iwb-ref-single', decoding: 'async', fetchPriority: 'low', src: wPreviewUrlOf((typeof wImgSrcForNode === 'function' ? wImgSrcForNode : wDisplayThumbOf)(wThumbSrc(src), Math.min(320, (props.node && props.node.w) || 280))), alt: '图片', draggable: false, onLoad: (e) => {
// v3.26.179:图片恢复可读时清掉「源已失效」标记 —— 之前 is-broken 是命令式加的,
// 换图后没有任何地方移除,遮罩会一直盖在新图上。
try {
const img = e.currentTarget
if (img && img.dataset) img.dataset.fb = ''
const host = img && img.closest ? img.closest('.iwb-ref-show') : null
if (host) host.classList.remove('is-broken')
} catch (err0) { /* ignore */ }
fitRefNodeOnce(e, props.node, onUpdate)
}, onError: (e) => {
// 第一次失败先退回原图;第二次仍失败 → 标记容器,换成「源已失效 · 双击重新导入」占位
// (用户 2026-11-29:破图图标会被误当成渲染 bug,必须明确告知是图片源丢了)
try {