Skip to content

fix(remote-access): 运行中安装插件后远端无法确认预览版说明(修复 #229) - #230

Merged
freedomkk-qfeng merged 1 commit into
ECNU:mainfrom
JunieXD:fix/229-remote-transaction-context
Oct 26, 2026
Merged

freedomkk-qfeng merged 1 commit into
ECNU:mainfrom
JunieXD:fix/229-remote-transaction-context

Conversation

@JunieXD

@JunieXD JunieXD commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

问题

修复 #229:在 DSH 运行中安装或启用远控插件后,手机配对成功,但点“预览版说明”的“继续”时提示“暂时无法保存确认状态”,刷新也进不去;重启应用后恢复正常。

原因

DSH 用 AsyncLocalStorage 标记配置事务,在事务里再写设置会以 HMR transactions cannot be nested 拒绝。插件管理器安装和启用插件都在 hmr.runExclusive 里进行,所以插件模块在事务里加载,加载时记下的上下文(AsyncLocalStorage.snapshot())也带着事务标记。远程访问在这个上下文里启动,手机的每个请求都会继承它,于是 settings/mutate 被拒绝。重启后插件在启动阶段加载,不在事务里,所以问题消失。

改动

  • 远程访问启动时,除了仍回到加载时的上下文外,还离开 DSH 的配置事务(hmr.executing.exit)。没有 hmr 服务时行为不变。门禁规则不变,远端仍只能写 welcomeNoticeVersion 这一项设置。
  • executing 在 DSH 的类型声明里是私有字段,DSH 没有提供其他离开事务的办法。代码注释写明了这一点,并注明已在 0.2.1-rc.2、rc.3 上核对。
  • 单测改为在模拟事务里导入构建产物。不加修复时,结果是 [true, undefined](事务标记泄漏)。

验证

  • npm run check(packages/dsh-remote-access):73 个测试通过。
  • 官方 DSH 0.2.1-rc.3,本机中继,接入密钥模式:
    • 修复前:运行中通过 pluginManager/installBundle 安装 0.1.1,手机点“继续”失败,返回 settings/rejected: HMR transactions cannot be nested;重启 DSH 后成功。
    • 修复后:同样在运行中安装修复版的打包产物,Chromium、WebKit 两种内核点“继续”都成功,说明版本已写入设置,刷新后不再弹出。
  • 未测:EduWork 桌面版(Windows、macOS)上经 npm 安装的完整路径,以及机构登录模式。两种模式启动远程访问走的是同一个入口。

Fixes #229

…ransaction

A plugin installed or enabled while DSH runs is loaded inside DSH's
configuration transaction, so the async context captured at load still
carried it, and a paired device's settings write (acknowledging the preview
notice) was refused as nested until DSH restarted. Remote access now also
leaves that transaction when it starts.

Fixes ECNU#229
@freedomkk-qfeng
freedomkk-qfeng merged commit 39cae80 into ECNU:main Oct 26, 2026
6 checks passed
@JunieXD
JunieXD deleted the fix/229-remote-transaction-context branch October 28, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 远控手机端卡在“预览版说明”:无法保存确认状态,刷新后仍无法进入

2 participants