Skip to content

normalize filter values before comparing them - #443

Open
grische wants to merge 2 commits into
freifunk:mainfrom
grische:fix/normalize-filter-values
Open

normalize filter values before comparing them#443
grische wants to merge 2 commits into
freifunk:mainfrom
grische:fix/normalize-filter-values

Conversation

@grische

@grische grische commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Ignores whitespaces and make device type filters case-insensitive.

Motivation and Context

With OpenWrt renaming ZyXEL to Zyxel, the filters in the map are ambigious at best. This PR allows filtering even if they are using different version of Gluon/OpenWrt.

How Has This Been Tested?

https://map.ffmuc.net/

Screenshots/links:

Checklist:

  • My code follows the code style of this project. (CI will test it anyway and also needs approval)
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

@grische grische changed the title Fix/normalize filter values normalize filter values before comparing them Aug 6, 2026
@maurerle

Copy link
Copy Markdown
Member

@grische can you rebase this please :)

grische and others added 2 commits August 11, 2026 09:32
The leaflet Map import shadows the global Map for the whole module, so
declaring a Map<K, V> fails to compile:

  error TS2315: Type 'Map' is not generic

The error is reported at the declaration rather than at the import
responsible for it.

Rename the import to LeafletMap and update its sole use in
getTileBBox. No functional change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Node attribute values are compared with === against the filter value,
which assumes every node spells a given value identically. Firmware
does not: OpenWrt renames devices between releases, so one node can
report "ZyXEL WSM20" while another running a newer image reports
"Zyxel WSM20", and some model names carry runs of padding whitespace.

The statistics sidebar therefore lists one row per spelling, and
activating a row silently excludes the nodes using any other spelling.
Rows that differ only in whitespace are indistinguishable in the UI,
leaving no way to tell why a node is missing from the map.

applyFiltersFromHash makes this worse for shared links: it collapses
whitespace in the value taken from the URL but not in the node value
it is compared against, so a filter on a value containing padding
whitespace matches when clicked and matches nothing once the URL it
produced is reloaded.

Normalize both sides of the comparison. collapseWhitespace provides
the display and URL form, normalizeFilterValue folds case on top of it
for matching, and mergeSpellingVariants merges the counted values so a
group occupies a single row labelled with its most common spelling.
Key GenericNodeFilter on the normalized value so variants of a value
toggle the same filter.

While here, skip undefined attribute values when counting: the
node.update modifier returns d.branch, which is undefined when a node
has the autoupdater enabled but no branch configured, producing a row
labelled "undefined".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@grische
grische force-pushed the fix/normalize-filter-values branch from ee4630c to 9f3c40d Compare August 11, 2026 07:33
@github-actions

Copy link
Copy Markdown
Contributor

Preview deployed: https://freifunk.github.io/meshviewer/pr-preview/pr-443/

Updated for commit 9f3c40d.

github-actions Bot pushed a commit that referenced this pull request Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants