SearchBox: fix crash from id-tagging-schema@7.0.0 - #1503
Merged
Conversation
### Description
`@openstreetmap/id-tagging-schema` translations are fetched from CDN
unpinned (always `latest`). Upstream changed `terms` from a
comma-separated string to a `string[]` — confirmed on the live CDN data:
1324 of 1731 presets now have `terms` as an array.
`getPresetTermsTranslation()` still called `.split(',')` on it, throwing
for almost every preset and breaking SearchBox preset search entirely
(Sentry: `TypeError: (0, y.MG).split is not a function`, ~1800+ events).
- `getPresetTermsTranslation()` now normalizes both shapes (array
passthrough, legacy string gets split, missing → `[]`) and returns
`string[]` directly.
- Removed the now-redundant `.split(',')` at the call site in
`preset.tsx`.
- Added `translations.test.ts` covering all 4 cases (array, legacy
string, missing terms, unknown preset key).
### Checklist
- [x] server-side-rendering (SSR) - n/a, client-only search code
- [x] all texts are localized (in vocabulary.ts) - n/a, no new UI text
https://claude.ai/code/session_01YChsE67uVMznndDeUHwbwA
---
_Generated by [Claude
Code](https://claude.ai/code/session_01YChsE67uVMznndDeUHwbwA)_
---------
(cherry picked from commit 2f7c69f032460819f8ee961b070ee555f5c87ccd)
The CDN fetch for `id-tagging-schema` translations was unpinned (always `latest`), which is how a breaking change (`terms` string → string[]) reached production unannounced and broke SearchBox (#120). Pins the CDN URL to `7.x` and bumps the npm dependency to match, so we still get updates but a future `8.0.0` won't silently break us again. - CDN fetch now resolves `@7` instead of unpinned latest. - `package.json`/`yarn.lock`: `@openstreetmap/id-tagging-schema` 6.12.0 → 7.0.1. - 7.x ships `.d.json.ts` declarations for its JSON exports - added `allowArbitraryExtensions` to `tsconfig.json` so `tsc` picks them up. - Updated one test snapshot for the resulting (alphabetical) field order from the schema bump. https://claude.ai/code/session_01YChsE67uVMznndDeUHwbwA --- _Generated by [Claude Code](https://claude.ai/code/session_01YChsE67uVMznndDeUHwbwA)_ (cherry picked from commit af0abc989cd0960352dbc1474b7761e709cfb6ef)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picked from openclimbing: fixes a SearchBox crash caused by an unpinned
id-tagging-schemaCDN upgrade, and pins the CDN/package version to7.xto prevent recurrence.Checklist
Generated by Claude Code