Skip to content

feat: add defaultReason prop to OffCycleReasonSelection - #2619

Open
krisxcrash wants to merge 2 commits into
mainfrom
feat/off-cycle-reason-selection-default-reason
Open

feat: add defaultReason prop to OffCycleReasonSelection#2619
krisxcrash wants to merge 2 commits into
mainfrom
feat/off-cycle-reason-selection-default-reason

Conversation

@krisxcrash

Copy link
Copy Markdown
Contributor

Summary

  • OffCycleReasonSelection hardcoded its form to start with no reason selected, with no way for a standalone consumer to pre-select "bonus" or "correction".
  • OffCycleCreation (the all-in-one component) already supports this via its own payrollType prop, so OffCycleReasonSelection was the one place this capability was missing for anyone using the reason picker on its own.
  • Adds an optional defaultReason prop (named consistently with the existing defaultPolicyType convention on PolicyTypeSelector), threaded into the internal form's defaultValues. Non-breaking: omitting the prop keeps the existing empty-selection behavior.

Test plan

  • npm run test -- --run src/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.test.tsx — added a test asserting the radio matching defaultReason is pre-checked
  • npx tsc --noEmit and npx eslint on touched files
  • Added a WithDefaultReason story to OffCycleReasonSelection.stories.tsx

🤖 Generated with Claude Code

krisxcrash and others added 2 commits August 21, 2026 15:26
Lets standalone consumers of the reason picker start with "bonus" or
"correction" pre-selected, matching the pre-selection support OffCycleCreation
already has via its own payrollType prop.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@krisxcrash
krisxcrash marked this pull request as ready for review August 21, 2026 22:32
@krisxcrash
krisxcrash requested a review from a team as a code owner August 21, 2026 22:32

@serikjensen serikjensen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My rec on this one would be to either hold off for it to be identified in the test fest. If we do decide to fix this now, i think we should update to use defaultValues on the form consistent with the other component APIs rather than setting it via defaultReason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants