fix(settings): 插件管理页 TDZ 崩溃(cmpV 改函数声明)v3.25.49

installedRows 在 cmpV 之前执行,const 未初始化 ⇒ 有已装插件时整页崩。改 function 声明(提升)。
This commit is contained in:
qiqi committed 2026-11-20 10:57:48 +08:00
1 parent 03347ef7e4
commit 4d1d05aaa0
6 files changed
+14 -5

No files matched your search

+8
View File
@@ -14,6 +14,14 @@
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
## v3.25.49(2026-11-20)修:打开「插件管理」整页崩溃(TDZ)
- 症状:更新到 3.25.48 后打开 设置 → 插件管理,整页报「Cannot access 'z' before initialization」(压缩后的 TDZ)。
- 原因:3.25.48 新增的 `cmpV` 写成 `const`,但 `installedRows`(在上方几行)渲染时就会调用它 ⇒ 块级作用域未初始化。
- 修复:改为**函数声明**(提升),并在注释里写明「此处不得改回 const」。
- 验证:本地脚本伪造「已安装 1.7.0(目录格式)」后打开插件页,无报错、无「界面出错了」。
- 教训:这类错误只有「已安装插件非空」时才会触发——空列表时 map 回调不执行,所以空环境冒烟测不出来。
## v3.25.48(2026-11-20)修:插件全部误报「可更新」
- 症状:3.25.47 里 7 个已装插件全部显示「可更新」,点「更新」其实没有新版本。
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.25.48",
"version": "3.25.49",
"description": "Browser-based node canvas image workbench",
"scripts": {
"build": "node scripts/build.js && node scripts/copy-plugins.js",
+1 -1
View File
@@ -1983,7 +1983,7 @@ dependencies = [
[[package]]
name = "image-workbench"
version = "3.25.48"
version = "3.25.49"
dependencies = [
"arboard",
"base64 0.22.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.25.48"
version = "3.25.49"
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.25.48",
"version": "3.25.49",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
+2 -1
View File
@@ -225,7 +225,8 @@
})()
const kb = function (n) { return !n ? '' : (n >= 1048576 ? (n / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round(n / 1024)) + ' KB') }
// 版本比较统一走 loader.compareVersions(>0 才算有更新;避免「对象 vs 字符串」误判、也避免市场回退版本时误报)
const cmpV = function (a, b) {
// ⚠️ 必须用**函数声明**:installedRows 在本段之上就会调用它,const 会 TDZ(v3.25.48 崩过一次)
function cmpV (a, b) {
const L = (typeof window !== 'undefined') ? window.IWBRuntimePluginLoader : null
if (L && typeof L.compareVersions === 'function') return L.compareVersions(a, b)
return String(a) === String(b) ? 0 : 1