fix: replace as any cast with defaultValue in Intoto error key#13101
Conversation
The fetch error handler used t(errorMsg as any) to translate server-structured error messages containing a dot (e.g. intoto_supply_chain.serverTimeout). Replaced with defaultValue so dynamic keys are accepted without bypassing type checking, and the raw message serves as fallback when no translation exists. Signed-off-by: AdeshDeshmukh <adeshkd123@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
👋 Hey @AdeshDeshmukh — thanks for opening this PR!
This is an automated message. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Intoto Supply Chain card’s fetch error rendering to avoid bypassing TypeScript checks when translating server-provided, dot-delimited error keys. It replaces an as any cast (and an eslint-disable) with defaultValue so unknown/dynamic keys fall back to the raw server message when no translation exists.
Changes:
- Replace
t(errorMsg as any)witht(errorMsg, { defaultValue: errorMsg })for dot-delimited server error strings. - Remove the inline eslint-disable that previously allowed the
anycast.
There was a problem hiding this comment.
Good fix — using defaultValue: errorMsg here is better than the as any cast. It correctly falls back to the raw server error message when no matching translation key exists, which is the right behavior for dynamic server-provided error strings. Removes the lint suppression cleanly. LGTM.
|
@kubestellar-hive[bot]: changing LGTM is restricted to collaborators DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
❌ Deploy Preview for kubestellarconsole failed. Why did it fail? →Built without sensitive environment variables
|
9dc0abe
into
kubestellar:main
✅ Post-Merge Verification: passedCommit: |
The fetch error handler used t(errorMsg as any) to translate server-structured error messages containing a dot. Replaced with defaultValue so dynamic keys are accepted without bypassing type checking, and the raw message serves as fallback when no translation exists. Removes the eslint-disable comment and as any cast.