fix(card): make card_network optional in CardElement rendering - #496
Closed
Pradeep-kumar1202 wants to merge 1 commit into
Closed
fix(card): make card_network optional in CardElement rendering#496Pradeep-kumar1202 wants to merge 1 commit into
Pradeep-kumar1202 wants to merge 1 commit into
Conversation
|
@hyperswitch-client-core-review-bot please review this PR. |
hs-agent
reviewed
May 7, 2026
hs-agent
left a comment
Contributor
There was a problem hiding this comment.
Verdict: ✅ Approve
🚫 0 critical ·
Fixes the blank card form bug for connectors without card_network. The name-based lookup is a solid structural improvement over positional indexing.
Contributor
Author
|
The intended changes went in this PR #524 |
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.
Type of Change
Summary
Array.get(0..4)inCardElement.reswith name-based lookup via the newSuperpositionHelper.findFieldByName.card.card_networkoptional — only the four essentials (number, exp month, exp year, cvc) gate the render.useFieldslot to localReact.useState. Card brand is a derived value, not user input, so it doesn't belong in form state by default.CardNetworkSyncrender-null component that registerscard_networkwith React Final Form and mirrors the local brand into form state — mounted only when superposition required the field.cardNetworkMetabranch from the error-display switch; brand is BIN-derived and never user-typed.Why
Superposition drives the dynamic field set per connector. For ~119 of 120 connectors,
card_networkis not in the required fields. The old positional pattern match expected exactly fiveSome(_)values, so the entire card form fell through toReact.nulland merchants saw a blank screen.Name-based lookup is order- and count-independent, so adding/removing optional fields no longer breaks the form. Lifting brand to local state cleanly separates client-side concerns (CVC sizing, formatting, co-badged dropdown) from the
submission contract.
Files changed
src/components/dynamic/CardElement.res— name-based lookup, optionalcard_network, local brand state,CardNetworkSyncinner module.shared-codeto pick upfindFieldByName.Screenshots / Recordings
Affected Area & Impact
Android PR / status (if any):
iOS PR / status (if any):
Shared Codebase PR / status (if any): juspay/hyperswitch-sdk-utils#54
Testing
Notes:
Checklist