fix: prefer the focused frame, bound model length, drop dead flag
This commit is contained in:
@@ -8,12 +8,8 @@ const field = (id) => document.getElementById(id);
|
||||
|
||||
let saveTimer = null;
|
||||
let statusTimer = null;
|
||||
// Suppresses the change/input handlers while we are programmatically writing
|
||||
// values into the form, so a remote sync cannot trigger a save loop.
|
||||
let applying = false;
|
||||
|
||||
function render(settings) {
|
||||
applying = true;
|
||||
for (const [id, value] of Object.entries(settings)) {
|
||||
const element = field(id);
|
||||
// Never overwrite the control the user is actively editing — this page's
|
||||
@@ -27,7 +23,6 @@ function render(settings) {
|
||||
element.value = value;
|
||||
}
|
||||
}
|
||||
applying = false;
|
||||
}
|
||||
|
||||
function collect() {
|
||||
@@ -60,9 +55,6 @@ async function persist(settings) {
|
||||
|
||||
// Debounced so typing in a text field cannot approach any write-rate quota.
|
||||
function scheduleSave() {
|
||||
if (applying) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(saveTimer);
|
||||
saveTimer = setTimeout(() => persist(collect()), SAVE_DEBOUNCE_MS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user