[OSDEV-2085] Refactored new claim form to store select labels directly and extract shared utility for the StyledSelect component#782
Conversation
📝 WalkthroughWalkthroughReplaces object-based relationship handling with string-based storage: adds Changes
Sequence Diagram(s)sequenceDiagram
participant UI as EligibilityStep (UI)
participant Util as findSelectedOption
participant Form as Formik (handleChange / setFieldValue)
rect rgb(235, 245, 255)
UI->>UI: User selects option (Select emits valueObject)
end
UI->>Util: findSelectedOption(RELATIONSHIP_OPTIONS, formData.relationship)
Util-->>UI: option | null
alt valueObject.value === "ELIGIBLE"
UI->>Form: setFieldValue('relationship', selectedOption)
else non-eligible selection
UI->>Form: handleChange('relationship', valueObject.label)
end
Note right of Form: validation expects relationship as string
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/react/src/components/InitialClaimFlow/ClaimForm/Steps/EligibilityStep/EligibilityStep.jsx (1)
164-164: Update PropTypes to reflect the new data model.The
relationshipfield is now validated as a string (see validationSchemas.js line 6), but the PropTypes still specifyoneOfType([string, object]). Update to reflect that relationship is now exclusively a string.Apply this diff:
- relationship: oneOfType([string, object]), + relationship: string,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/react/src/components/InitialClaimFlow/ClaimForm/Steps/EligibilityStep/EligibilityStep.jsx(3 hunks)src/react/src/components/InitialClaimFlow/ClaimForm/Steps/utils.js(1 hunks)src/react/src/components/InitialClaimFlow/ClaimForm/validationSchemas.js(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/react/src/components/InitialClaimFlow/ClaimForm/Steps/EligibilityStep/EligibilityStep.jsx (2)
src/react/src/components/InitialClaimFlow/ClaimForm/Steps/utils.js (1)
findSelectedOption(5-8)src/react/src/components/InitialClaimFlow/ClaimForm/Steps/EligibilityStep/constants.js (1)
RELATIONSHIP_OPTIONS(1-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: get-base-branch-countries-cov
- GitHub Check: run-flake8-linter
- GitHub Check: run-dd-code-quality
- GitHub Check: run-integration-test-code-quality
- GitHub Check: get-base-branch-dd-cov
- GitHub Check: run-eslint-linter-and-prettier-formatter
- GitHub Check: run-contricleaner-code-quality
- GitHub Check: get-base-branch-contricleaner-cov
- GitHub Check: run-countries-code-quality
- GitHub Check: run-fe-code-quality
- GitHub Check: run-django-code-quality
- GitHub Check: get-base-branch-django-cov
- GitHub Check: get-base-branch-fe-cov
🔇 Additional comments (2)
src/react/src/components/InitialClaimFlow/ClaimForm/validationSchemas.js (1)
6-8: LGTM! Schema update aligns with the refactor.The change from
Yup.object()toYup.string()correctly reflects the new data model where relationship is stored as a label string rather than an option object.src/react/src/components/InitialClaimFlow/ClaimForm/Steps/EligibilityStep/EligibilityStep.jsx (1)
36-39: Utility usage looks correct.The
findSelectedOptionutility is properly used here to derive the option object from the stored label string for the StyledSelect component.
src/react/src/components/InitialClaimFlow/ClaimForm/Steps/EligibilityStep/EligibilityStep.jsx
Show resolved
Hide resolved
|
React App | Jest test suite - Code coverage reportTotal: 36.38%Your code coverage diff: 0.01% ▴ ✅ All code changes are covered |



[OSDEV-2085]
findSelectedOptionutility for StyledSelect components, reducing code duplication across form steps