fix: open detail page when clicking edit for time-off policies#1690
Open
jeffredodd wants to merge 1 commit intomainfrom
Open
fix: open detail page when clicking edit for time-off policies#1690jeffredodd wants to merge 1 commit intomainfrom
jeffredodd wants to merge 1 commit intomainfrom
Conversation
The TIME_OFF_VIEW_POLICY transition guarded on policyType === 'sick' || 'vacation', but the API's PolicyType union includes bereavement, custom, floating_holiday, jury_duty, learning_and_development, parental_leave, personal_day, volunteer, and weather. Companies migrated from Gusto.com may have any of these attached to their account. For any non-sick/vacation/holiday type the event matched no guard, the state machine swallowed it, and clicking "Edit policy" in the kabob menu appeared to do nothing. Rename the guard to isNonHolidayView (returns policyType !== 'holiday') so any non-holiday policy routes to viewTimeOffPolicyDetail. Broaden TimeOffPolicyType to PolicyType | 'holiday' so the context can hold the broader values, and narrow back at the create-policy selector site. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5a332f0 to
4f26526
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes TimeOffFlow navigation so TIME_OFF_VIEW_POLICY correctly opens the policy detail screen for any non-holiday time-off policy type (e.g., custom, bereavement, parental_leave, etc.), instead of being silently ignored due to overly narrow guards/types.
Changes:
- Updated the
TIME_OFF_VIEW_POLICYguard to route all non-holidaypolicy types toviewTimeOffPolicyDetail. - Broadened
TimeOffPolicyTypeto accept the full APIPolicyTypeunion (plus'holiday') so flow context/payloads can represent migrated policy types. - Added parameterized state-machine tests covering several non-holiday policy types and updated the policy-type selector defaulting to only preselect
sick/vacation/holiday.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/components/UNSTABLE_TimeOff/TimeOffFlow/timeOffStateMachine.ts | Broadens view-policy payload typing and updates the view-policy guard to route all non-holiday policies to the standard detail state. |
| src/components/UNSTABLE_TimeOff/TimeOffFlow/timeOffStateMachine.test.ts | Adds coverage to ensure non-holiday (non sick/vacation) policy types transition to viewTimeOffPolicyDetail. |
| src/components/UNSTABLE_TimeOff/TimeOffFlow/timeOffPolicyTypes.ts | Expands TimeOffPolicyType to include all API policy types, enabling flow context to hold migrated values. |
| src/components/UNSTABLE_TimeOff/TimeOffFlow/TimeOffFlowComponents.tsx | Prevents invalid defaults in the create-policy selector by only defaulting when policyType is one of sick/vacation/holiday. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
TIME_OFF_VIEW_POLICYtransition guarded onpolicyType === 'sick' || 'vacation'. The API'sPolicyTypeunion also includesbereavement,custom,floating_holiday,jury_duty,learning_and_development,parental_leave,personal_day,volunteer, andweather(companies migrated from Gusto.com may have any of these).isNonHolidayView(returnspolicyType !== 'holiday') so any non-holiday policy routes toviewTimeOffPolicyDetail.TimeOffPolicyTypetoPolicyType | 'holiday'so the context can hold the broader values; narrows back at the create-policy selector site (which only renders sick/vacation/holiday).This is PR 11 in the time-off bug-fix slate captured in
~/.claude/plans/ok-i-want-to-partitioned-balloon.md.Test plan
npm run test -- --run src/components/UNSTABLE_TimeOff/TimeOffFlow/— 43/43 passing (added 5 parameterized tests forcustom,bereavement,parental_leave,jury_duty,volunteer)npx tsc --noEmit— cleannpm run test -- --run src/components/UNSTABLE_TimeOff/— 302/302 passing🤖 Generated with Claude Code