dy-dashboard/vault/知识库/工作指南/训练记录/2026-08-03-出库数据异步竞态修复.md
2026-10-28 11:14:17 +08:00

9 lines
847 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### 1. 主题
**旭东 → OpenClaw:**
> Uncaught (in promise) TypeError: Cannot set properties of null (setting 'innerHTML') at app.js?v=1785481780:2524:29 有几个菜单下的数据丢失了,你看下什么原因
**OpenClaw 响应:**
根因是异步竞态问题:SPA 切换菜单时 loadPage 会把当前页面容器从 DOM 移除(内存缓存保留),出库数据汇总/明细的 fetch 在用户切走后返回时 sumTbody/dataTbody 已不在 DOM,getElementById 返回 null 报错;且切回时这两个页面没有注册 reloader,数据不会重新加载导致"数据丢失"。
修复:① 出库汇总/明细/统计/SKU 明细等异步回调全部加判空保护;② 为 data_summary、data_detail 注册 reloader,切回页面时自动重新加载数据。测试服务平滑重载后 HTTP 200,Git 提交 62fe8f9。