Skip to content

Commit 19bbc3c

Browse files
committed
webui: sync only when changed
1 parent 89acd9c commit 19bbc3c

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

webui/webui.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ <h1>UMod 配置</h1>
129129
return JSON.parse(JSON.stringify(obj));
130130
}
131131

132+
function deepEqual(a, b) {
133+
return JSON.stringify(a) === JSON.stringify(b);
134+
}
135+
132136
/* ================= 加载 ================= */
133137

134138
async function loadSchema() {
@@ -139,9 +143,11 @@ <h1>UMod 配置</h1>
139143
if (dirty && remote) return;
140144

141145
const data = await fetch(API.config).then(r => r.json());
142-
config = deepClone(data);
143-
render();
144-
setStatus("已同步");
146+
if(!deepEqual(data, config)) {
147+
config = deepClone(data);
148+
render();
149+
setStatus("已同步");
150+
}
145151
}
146152

147153
async function init() {

0 commit comments

Comments
 (0)