mirror of
https://github.com/ipnet-mesh/meshcore-hub.git
synced 2026-08-07 17:33:20 +02:00
fix: n is not defined in observer filter badges
Commit37f8d7are-introduced emoji extraction in observerFilterBadges afterd1a3605had refactored the iteration variable from `n` (node object) to `area` (plain string). Three references to n._displayName and n.public_key were left behind, throwing ReferenceError the moment any observer had an area tag. Adverts and Messages pages surface this as a warning badge with the error message; the early return hides the bug on deployments with no area-tagged observers. Replace n.X with area (the iteration variable). Emoji extraction and label fallback now operate on the area string directly.
This commit is contained in:
@@ -659,12 +659,12 @@ export function observerFilterBadges({ areas, disabled, onToggle, extraClass = '
|
||||
const title = enabled
|
||||
? t('common.filter_observer_disable')
|
||||
: t('common.filter_observer_enable');
|
||||
const emoji = extractFirstEmoji(n._displayName);
|
||||
const label = emoji ? (n._displayName.replace(emoji, '').trim() || n._displayName) : n._displayName;
|
||||
const emoji = extractFirstEmoji(area);
|
||||
const label = emoji ? (area.replace(emoji, '').trim() || area) : area;
|
||||
return html`<button type="button"
|
||||
class="${cls} cursor-pointer"
|
||||
title=${title}
|
||||
@click=${() => onToggle(n.public_key)}>${emoji ? html`<span class="mr-1">${emoji}</span>` : nothing}${label}</button>`;
|
||||
@click=${() => onToggle(area)}>${emoji ? html`<span class="mr-1">${emoji}</span>` : nothing}${label}</button>`;
|
||||
})}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user