Current State
Only ?personId= works across the application (via usePerson hook). The budget allocation page just received ?year= and ?eventCode= query parameter support, but other pages lack URL-driven state management.
Goal
All PersonLayout-based pages should support URL-driven state for deep linking, bookmarkability, and share-ability. This enables:
- Deep linking from notifications and emails
- Bookmarkable filtered/personalized views
- Browser back/forward support
- Shareable URLs between team members
Pages to Update
/budget-allocations - personId, year, eventCode, typeFilter (partially done)
/workdays - personId, year, month
/expense - personId, year
/contract - personId
/assignment - personId
/event - page number, search filter
Approach
Create a shared useUrlState hook that syncs React state with URL query params, building on the existing usePerson pattern but making it generic and reusable across all pages.
The hook should:
- Read query params from URL on mount
- Sync state changes back to URL
- Handle browser history (back/forward)
- Work with React Router v5's useHistory/useLocation
Implementation Strategy
- Create
useUrlState hook in a shared location (e.g., workday-application/src/main/react/hooks/useUrlState.ts)
- Wire up each page individually to use the hook for their specific state
- Test deep linking and bookmarking behavior
- Update PersonLayout pattern to encourage URL state adoption
Scope
Medium effort - the hook is reusable, but each page needs individual wiring and testing.
Benefits
- Shareable URLs: Team members can share specific filtered views
- Deep linking: Direct links from emails/notifications to specific person + filters
- Bookmarkable: Users can save and return to their preferred views
- Browser navigation: Back/forward buttons work naturally across filter changes
Current State
Only
?personId=works across the application (viausePersonhook). The budget allocation page just received?year=and?eventCode=query parameter support, but other pages lack URL-driven state management.Goal
All PersonLayout-based pages should support URL-driven state for deep linking, bookmarkability, and share-ability. This enables:
Pages to Update
/budget-allocations- personId, year, eventCode, typeFilter (partially done)/workdays- personId, year, month/expense- personId, year/contract- personId/assignment- personId/event- page number, search filterApproach
Create a shared
useUrlStatehook that syncs React state with URL query params, building on the existingusePersonpattern but making it generic and reusable across all pages.The hook should:
Implementation Strategy
useUrlStatehook in a shared location (e.g.,workday-application/src/main/react/hooks/useUrlState.ts)Scope
Medium effort - the hook is reusable, but each page needs individual wiring and testing.
Benefits