Profile: try/catch в renderChips click + console.error при отсутствии el

This commit is contained in:
root 2026-08-20 21:58:35 +00:00
parent fd8f6b38d0
commit ce3c863e66

View File

@ -78,14 +78,17 @@ const ProfileView = {
renderChips(elId, items, selected) {
const el = document.getElementById(elId);
if (!el) { console.error('renderChips: no element', elId); return; }
items.forEach(([key, label]) => {
const chip = document.createElement('span');
chip.className = 'chip' + (selected.has(key) ? ' active' : '');
chip.textContent = label;
chip.onclick = () => {
if (selected.has(key)) selected.delete(key); else selected.add(key);
chip.classList.toggle('active');
TG_APP.haptic('selection');
try {
if (selected.has(key)) selected.delete(key); else selected.add(key);
chip.classList.toggle('active');
TG_APP.haptic('selection');
} catch (e) { console.warn('chip click err', e); }
};
el.appendChild(chip);
});