Files
Nexus/docs/changelog/2026-06-02-file-editor-ref-props-fix.md
T
2026-07-08 22:31:31 +08:00

1.3 KiB

2026-06-02 文件编辑器卡住(空壳遮罩)修复

日期

2026-06-02

变更摘要

修复点击「编辑」后页面卡住、出现透明全屏遮罩无法操作的问题。

动机

生产环境监听控制台得到:TypeError: (e ?? "").trim is not a function。浮动层 file-editor-float 已渲染但内部 v-card 因渲染异常未挂载,留下 968×758 透明层拦截所有点击。

根因

FilesPage.vueFileEditorWorkbench 传入 page.currentPath / page.selectedServer 时未经过 proxyRefs,子组件收到的是 Vue Ref 对象而非字符串/数字。normalizeRemotePath(Ref) 对非字符串调用 .trim() 抛错,编辑器面板渲染失败。

涉及文件

  • frontend/src/pages/FilesPage.vue — 模板绑定改用 proxyRefs(page)filesPage
  • frontend/src/utils/remotePath.tscoercePathString 防御性入参
  • frontend/src/components/FileEditorWorkbench.vueopenFile try/catch、v-tabs 绑定、空 tab 不显示遮罩

迁移 / 重启

  • 仅前端:需重新 vite build 并部署 web/app/
  • 无需重启后端

验证方式

  1. 强刷 Ctrl+Shift+R 打开文件管理,选服务器后点任意文件「编辑」
  2. 应出现完整编辑器(工具栏、目录树、Monaco),页面可继续点击
  3. 控制台无 trim is not a function