Skip to content

fix: preserve date picker state when switching back from unlimited#1904

Open
krisxcrash wants to merge 1 commit into
mainfrom
kw/timeoff-datepicker-after-unlimited-switch
Open

fix: preserve date picker state when switching back from unlimited#1904
krisxcrash wants to merge 1 commit into
mainfrom
kw/timeoff-datepicker-after-unlimited-switch

Conversation

@krisxcrash
Copy link
Copy Markdown
Contributor

Summary

  • The useEffect that clears form fields on accrual method change now returns early for unlimited, preserving resetDateType, resetMonth, and resetDay in hidden form state.
  • Switching from an accrual method to unlimited and back now restores the custom date picker and its previously-selected values.

Fixes bug: selecting unlimited then switching back to accrual hides the date picker and auto-fills Jan 1.

Test plan

  • Existing PolicyConfigurationForm.test.tsx passes (41/41)
  • Manually verify: set per-year accrual with custom date → switch to unlimited → switch back → date picker shows with previous values

@krisxcrash krisxcrash self-assigned this May 21, 2026
@krisxcrash krisxcrash marked this pull request as ready for review May 21, 2026 22:46
@krisxcrash krisxcrash requested a review from a team as a code owner May 21, 2026 22:46
@krisxcrash krisxcrash enabled auto-merge (squash) May 21, 2026 23:45
@jeffredodd jeffredodd force-pushed the kw/timeoff-datepicker-after-unlimited-switch branch from 88d8bb7 to 94c3ead Compare May 22, 2026 00:58
When switching to unlimited and back to an accrual method, the custom
reset date picker wasn't showing because the useEffect aggressively
cleared resetDateType. Now the effect returns early for unlimited,
preserving form state so the date picker restores on switch-back.
@jeffredodd jeffredodd force-pushed the kw/timeoff-datepicker-after-unlimited-switch branch from 94c3ead to d05a532 Compare May 22, 2026 02:09
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