feat: DevTools DOM 增量更新优化 — 减少全量重建
三层优化: - 第1层:所有自动刷新面板加入 djb2 哈希跳过,数据未变不重建 DOM - 第2层:Tool Calls/STT/Timeline 展开状态保存/恢复,重建后自动恢复 - 第3层:Services/Dashboard/Sessions 面板就地更新属性值,不重建卡片 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -53,7 +53,11 @@ async function renderIoTPanel() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 数据未变则跳过 (设备列表不变)
|
||||
var devices = result.devices;
|
||||
var iotHash = simpleHash(JSON.stringify(devices));
|
||||
if (STATE.renderHashes && STATE.renderHashes['iot'] === iotHash) return;
|
||||
if (STATE.renderHashes) STATE.renderHashes['iot'] = iotHash;
|
||||
|
||||
// 固定设备排列顺序: 先按类型,同类型再按 device_id
|
||||
var typeOrder = { 'sensor': 1, 'ac': 2, 'light': 3, 'curtain': 4, 'lock': 5, 'camera': 6, 'speaker': 7, 'thermostat': 8 };
|
||||
|
||||
Reference in New Issue
Block a user