Skip to content

Commit e858161

Browse files
[IMP] web_form_banner: adj to resolve eslint warnings
1 parent dbff15b commit e858161

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

web_form_banner/static/src/js/web_form_banner.esm.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
// Copyright 2025 Quartile (https://www.quartile.co)
33
// License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
44

5-
import {patch} from "@web/core/utils/patch";
65
import {onMounted, onWillUnmount} from "@odoo/owl";
76
import {FormController} from "@web/views/form/form_controller";
87
import {Record} from "@web/model/relational_model/record";
8+
import {patch} from "@web/core/utils/patch";
99

1010
const recRoot = (c) => (c && c.model && c.model.root) || null;
1111
const childSpan = (el) => {
1212
try {
1313
return (el && el.querySelector(":scope > span")) || null;
14-
} catch {}
14+
} catch {
15+
// Ignore
16+
}
1517
const f = el && el.firstElementChild;
1618
return f && f.tagName === "SPAN" ? f : null;
1719
};
@@ -22,10 +24,13 @@ const setHtml = (el, html) => {
2224
const safe = async (fn, fb) => {
2325
try {
2426
return await fn();
25-
} catch {}
27+
} catch {
28+
// Ignore
29+
}
2630
return fb;
2731
};
2832

33+
/* eslint-disable no-inline-comments */
2934
function normalizeValue(v) {
3035
if (v === null || v === undefined) return v; // Null/undefined
3136
const t = typeof v;
@@ -77,7 +82,7 @@ async function refreshBanners(ctrl, extraChanges) {
7782
if (!nodes.length) return;
7883
const snap = {...shrink(rec.data), ...shrink(extraChanges)};
7984
const names = triggerNames(ctrl);
80-
const vals = !rec.resId ? snap : names.length ? sliceBy(snap, names) : {};
85+
const vals = rec.resId ? (names.length ? sliceBy(snap, names) : {}) : snap;
8186
const orm = ctrl.env.services.orm;
8287
for (const el of nodes) {
8388
const ruleId = parseInt(el.dataset.ruleId, 10);
@@ -98,7 +103,10 @@ async function refreshBanners(ctrl, extraChanges) {
98103
function scheduleRefresh(ctrl) {
99104
if (ctrl.__wfbSched) return;
100105
ctrl.__wfbSched = true;
101-
requestAnimationFrame(() => ((ctrl.__wfbSched = false), refreshBanners(ctrl)));
106+
requestAnimationFrame(() => {
107+
ctrl.__wfbSched = false;
108+
refreshBanners(ctrl);
109+
});
102110
}
103111

104112
function tick(ctrl) {
@@ -164,7 +172,9 @@ patch(Record.prototype, {
164172
const ctrl = this.model.__controller;
165173
if (ctrl) tick(ctrl);
166174
}
167-
} catch {}
175+
} catch {
176+
// Ignore
177+
}
168178
return res;
169179
},
170180
});

0 commit comments

Comments
 (0)