airqo-platform / airqo-platform/AirQo-frontend
[Bug] Case-insensitive location matching fails, silently misclassifying data as missing
- Langage dominant
- TypeScript
- Étoiles
- 23
- Forks
- 48
- Merge moyen
- 15 h 24 min
- PR mergées (30 j)
- 57
Description
# [Bug] Case-insensitive location matching fails, silently misclassifying data as missing
## Summary
Partial-data-availability logic compares site/device names without normalizing case, so an API-returned `Makerere` against a stored selection of `makerere` is classified as "missing" even though it matches — producing an incorrect "no data available" warning, and naming the wrong location in the toast message.
## Review status
No "addressed" marker on the CodeRabbit comment below — likely still open.
## Where this came from
- CodeRabbit: "`getResponseLocationIds` adds identifiers with their original casing. The probes `responseIds.has(name.toLowerCase())` and `responseIds.has(id.toLowerCase())` therefore only succeed when the response value was already lowercase. If the API returns `Makerere` and the selection stores `makerere`, the location is classified as missing and the toast... names it incorrectly. Normalize both sides of the comparison." (`useDataExportActions.ts`, also applies to a second block at lines 781-802)
- Related, same review round: "If no selected location matches, `missingNames.length === selectedIds.length` and the function returns `undefined`... this branch hides a genuine matching failure, and the user sees no warning at all." (silent swallow of a total mismatch, same file, ~lines 809-811)
- Separately (2026-07-30 review, marked addressed): `selectedGridSiteIds` truthiness bug where the default-site fallback never applies for custom selections — this specific one **was** marked addressed.
## Affected files
- `src/nexus/src/modules/data-download/hooks/useDataExportActions.ts`
## Suggested fix
Normalize (trim + lowercase) both sides before comparing site/device identifiers. Surface (log or visibly flag) a total identifier-matching failure instead of silently returning `undefined`.
## Acceptance criteria
- [ ] Matching is case-insensitive and whitespace-trimmed
- [ ] A complete identifier-matching failure is observable, not silently dropped
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.