From 7bc0752cec67c20b7fabf3bcff851669f552d1bf Mon Sep 17 00:00:00 2001 From: qiqi Date: Tue, 1 Dec 2026 17:40:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20v3.26.172=20=E6=96=B0=E5=9B=BE=E6=97=A0?= =?UTF-8?q?=E7=BC=A9=E7=95=A5=E5=9B=BE=E6=97=B6=E6=9C=80=E5=A4=9A=E5=8D=A0?= =?UTF-8?q?=E4=BD=8D=20300ms=20=E5=90=8E=E5=9B=9E=E9=80=80=E5=8E=9F?= =?UTF-8?q?=E5=9B=BE=EF=BC=88=E4=BF=AE=E6=A0=87=E6=B3=A8=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E5=8E=9F=E5=9B=BE=E5=90=8E=E8=8A=82=E7=82=B9=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- src/image-thumb-pick.js | 12 ++++++++++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 30bff3b..c218f3d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "image-workbench-web", "private": true, - "version": "3.26.171", + "version": "3.26.172", "description": "Browser-based node canvas image workbench", "scripts": { "build": "node scripts/build.js && node scripts/copy-plugins.js", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 19eef87..bbf43a7 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2014,7 +2014,7 @@ dependencies = [ [[package]] name = "image-workbench" -version = "3.26.170" +version = "3.26.172" dependencies = [ "arboard", "base64 0.22.1", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index dd771f2..cb3a873 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "image-workbench" -version = "3.26.171" +version = "3.26.172" description = "无限画布 · 生图工作台桌面版" authors = ["malongan"] license = "" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 3cd3bc7..46ddb29 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "image-workbench", - "version": "3.26.171", + "version": "3.26.172", "identifier": "com.malongan.imageworkbench", "build": { "frontendDist": "../dist", diff --git a/src/image-thumb-pick.js b/src/image-thumb-pick.js index 1c280aa..613aecf 100644 --- a/src/image-thumb-pick.js +++ b/src/image-thumb-pick.js @@ -11,6 +11,7 @@ function create (deps) { const d = deps || {} + const missAt = new Map() // key -> 首次发现「无缩略图」的时间(300ms 后回退原图) const cache = d.cache // Map const max = Math.max(64, Number(d.max) || 768) // v3.26.121:小档(256)缓存与队列;缺省不启用(只有注入时才分档) @@ -56,13 +57,20 @@ // 小图没就绪时先给 512(已有就秒出)或占位,绝不为了"小一档"去同步解原图。 if (key && smallCache && need <= smallMax) { const sm = smallCache.get(key) - if (sm) return sm + if (sm) { missAt.delete(key); return sm } const orig0 = (v && typeof v === 'object') ? ((typeof d.resolveImg === 'function' ? d.resolveImg(v) : '') || '') : String(v || '') if (orig0 && !/^https?:/i.test(orig0) && typeof smallQueue === 'function') smallQueue(key, orig0) if (thumb) return thumb - return /^https?:/i.test(orig0) ? orig0 : (thumb || '') + // 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 || '' } if (thumb && need <= ORIG_HARD_CAP) return thumb const orig = (v && typeof v === 'object')