fix: 拓扑位置 fallback 空对象判断 + Electron 默认页 + asar 正确打包
Some checks failed
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
Star History / update (push) Has been cancelled
Some checks failed
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
Star History / update (push) Has been cancelled
根因 1:monitoring-topology-positions 在 portable Local Storage 里是空对象 {}
- {} 是 truthy,跳过 fallback
- L2335 if (savedPositions) 也是 truthy,跳过 else 大圆圈
- 但 savedPositions[d.id] 全 undefined → 所有设备落到 rest.forEach → 大圆圈
根因 2:手动 asar pack ./dist 只打了 dist 没打 package.json/electron → Electron 默认页
修复:
- L2311-2315: 空对象也跳过,继续 fallback 主进程 JSON
- L2339: 渲染前加 length>0 防御
- 清理 default_app.asar
- 用 electron-builder 正确打包(asar 包含 package.json + electron/ + dist/ + node_modules)
This commit is contained in:
@@ -2309,7 +2309,11 @@ export function MonitoringTopologyView({ hosts, keys }: Props) {
|
|||||||
// 本地 Electron:从 localStorage 读,找不到则从主进程 inspection-data.json 读
|
// 本地 Electron:从 localStorage 读,找不到则从主进程 inspection-data.json 读
|
||||||
try {
|
try {
|
||||||
let saved = localStorage.getItem('monitoring-topology-positions');
|
let saved = localStorage.getItem('monitoring-topology-positions');
|
||||||
if (saved) return JSON.parse(saved);
|
if (saved) {
|
||||||
|
const parsed = JSON.parse(saved);
|
||||||
|
// 空对象 {} 等于没有,继续 fallback
|
||||||
|
if (parsed && typeof parsed === 'object' && Object.keys(parsed).length > 0) return parsed;
|
||||||
|
}
|
||||||
// portable 版 localStorage 为空 → fallback 主进程 JSON(sendSync 同步)
|
// portable 版 localStorage 为空 → fallback 主进程 JSON(sendSync 同步)
|
||||||
try {
|
try {
|
||||||
const nc = (window as any).netcatty;
|
const nc = (window as any).netcatty;
|
||||||
@@ -2332,7 +2336,7 @@ export function MonitoringTopologyView({ hosts, keys }: Props) {
|
|||||||
const MIN_Y = -0.5;
|
const MIN_Y = -0.5;
|
||||||
const MAX_Y = 20;
|
const MAX_Y = 20;
|
||||||
|
|
||||||
if (savedPositions) {
|
if (savedPositions && Object.keys(savedPositions).length > 0) {
|
||||||
devices.forEach((d) => {
|
devices.forEach((d) => {
|
||||||
if (savedPositions[d.id]) {
|
if (savedPositions[d.id]) {
|
||||||
positions[d.id] = new THREE.Vector3(
|
positions[d.id] = new THREE.Vector3(
|
||||||
|
|||||||
Reference in New Issue
Block a user