fix(heureka): coerce numeric searchTerm URL param to string in search box - #1893
Open
hodanoori wants to merge 6 commits into
Open
fix(heureka): coerce numeric searchTerm URL param to string in search box#1893hodanoori wants to merge 6 commits into
hodanoori wants to merge 6 commits into
Conversation
…tring When a user types a single digit in the search box, TanStack Router parses it as a number from the URL. z.string().optional() rejects numbers, causing a parse error and breaking the app. Add z.preprocess to coerce numbers to strings before validation, matching the fix already in the vulnerabilities route. Signed-off-by: Hoda Noori <hoda.noori@sap.com>
🦋 Changeset detectedLatest commit: d6709fc The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates multiple route search schemas to accept numeric searchTerm inputs by preprocessing them into strings before Zod validation.
Changes:
- Added a Zod
preprocessstep to coerce numericsearchTermvalues to strings inalerts,services, andviolationsroutes. - Kept the rest of the query schema structure unchanged.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/supernova/src/routes/alerts.tsx | Coerces numeric searchTerm to string during search query parsing. |
| apps/heureka/src/routes/services/index.tsx | Coerces numeric searchTerm to string during services search query parsing. |
| apps/doop/src/routes/violations.tsx | Coerces numeric searchTerm to string during violations search query parsing. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
… and broaden coercion - Add optionalStringSchema to each app's utils/helpers file to avoid duplicating the preprocess logic across routes - Broaden coercion from number-only to any primitive (number | boolean) with explicit type cast to satisfy no-base-to-string lint rule - Use the shared schema in all affected routes Signed-off-by: Hoda Noori <hoda.noori@sap.com>
Signed-off-by: Hoda Noori <hoda.noori@sap.com>
Signed-off-by: Hoda <107242553+hodanoori@users.noreply.github.com>
TilmanHaupt
approved these changes
Aug 17, 2026
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.
Summary
Fixes a crash in Heureka (Services), Doop, and Supernova when typing a single digit in the search box. TanStack Router parses
?searchTerm=3as a number from the URL, andz.string().optional()rejects numbers, causing a Zod parse error that breaks the app. Applies the same coercion pattern already present in the Heureka Vulnerabilities route (which was not affected) to the three routes that were missing it.The fix uses a shared
optionalStringSchemahelper defined in each app's own utils/helpers file, which coerces any non-string primitive (number, boolean) to string while passingundefined/nullthrough unchanged.Changes Made
optionalStringSchemahelper toapps/heureka/src/utils.ts,apps/doop/src/lib/helpers.ts, andapps/supernova/src/lib/utils.tsoptionalStringSchemaforsearchTerminapps/heureka/src/routes/services/index.tsx(replacing inlinez.string().optional())optionalStringSchemaforsearchTerminapps/heureka/src/routes/vulnerabilities/index.tsx(replacing previous inlinez.preprocess)optionalStringSchemaforsearchTerminapps/doop/src/routes/violations.tsxoptionalStringSchemaforsearchTerminapps/supernova/src/routes/alerts.tsxRelated Issues
Screenshots (if applicable)
Testing Instructions
pnpm ipnpm TASKChecklist
PR Manifesto
Review the PR Manifesto for best practises.