fix: v3.26.172 新图无缩略图时最多占位 300ms 后回退原图(修标注替换原图后节点空白)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 41s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 41s
This commit is contained in:
1 parent
56975e69fd
commit
7bc0752cec
5 files changed
+14
-6
No files matched your search
+1
-1
@@ -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",
|
||||
|
||||
Generated
+1
-1
@@ -2014,7 +2014,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image-workbench"
|
||||
version = "3.26.170"
|
||||
version = "3.26.172"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"base64 0.22.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "image-workbench"
|
||||
version = "3.26.171"
|
||||
version = "3.26.172"
|
||||
description = "无限画布 · 生图工作台桌面版"
|
||||
authors = ["malongan"]
|
||||
license = ""
|
||||
|
||||
@@ -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",
|
||||
|
||||
+10
-2
@@ -11,6 +11,7 @@
|
||||
|
||||
function create (deps) {
|
||||
const d = deps || {}
|
||||
const missAt = new Map() // key -> 首次发现「无缩略图」的时间(300ms 后回退原图)
|
||||
const cache = d.cache // Map<stableKey, url>
|
||||
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')
|
||||
|
||||
Reference in new issue
Block a user