You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: hide assigned employees from time-off add list (SDK-894) (#1843)
* fix: hide assigned employees from time-off add list (SDK-894)
Refactor SelectEmployees to be add-only with full client-side filter,
search, and pagination. Resolves the empty-page bug where server-paginated
results were filtered client-side, producing visually empty pages after
adding employees from the first page.
Also filters out employees with a future hire_date to prevent the
"ineligible employees" 422 from the add-employees endpoint.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor: gate DataTable select-all on row count, drop local override
Mirror DataCards' empty-data behavior in DataTable so the select-all
header checkbox auto-hides when there are no rows. Removes the
consumer-side hideSelectAll={employees.length === 0} from
SelectEmployeesPresentation since it's now automatic.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: direct unit coverage for hideSelectAll/hideSearch/isStartedByToday + multi-page fetch
- DataTable & DataCards: tests for hideSelectAll opt-out and empty-data
auto-hide of the select-all control.
- EmployeeTable: tests for hideSearch prop (search container hidden when
true, rendered when false).
- isStartedByToday: edge-case unit tests (undefined, empty string,
today exactly, past, +1 day, far future) with system time pinned.
- useSelectEmployeesData multi-page: integration tests covering the
x-total-pages header branch — no extra queries when totalPages is 1,
buildEmployeesListQuery fires for pages 2..N when >1, and pages merge
into the displayed list.
Also documents the implicit per-origin concurrency ceiling in
useSelectEmployeesData (no explicit cap on parallel page fetches).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: direct coverage for pagination handlers and safeCurrentPage clamp
renderHook-based tests for useSelectEmployeesData pagination state machine:
- handleFirstPage / handleLastPage / handleNextPage / handlePreviousPage
including clamps at 1 and totalPages
- handleItemsPerPageChange resets currentPage to 1 and is a no-op when
the value matches
- handleSearchChange / handleSearchClear reset currentPage to 1
- safeCurrentPage clamps when a search shrinks totalPages below the
user's current page
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor: replace custom pagination with useClientPagination (#1887)
* refactor: replace custom pagination with useClientPagination
Drops the hand-rolled in-memory pagination/search state machine from
`useSelectEmployeesData` in favor of the newly merged `useClientPagination`
hook. Same external behavior — multi-page fetch, future-hire-date filter,
hide-assigned filter, search + pagination — but ~60 fewer lines and one
shared implementation across the SDK.
The hook's built-in 120ms search debounce is now active for this flow as
a bonus. Tests updated to wait for the debounce instead of asserting
synchronously after `userEvent.type`.
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs: regenerate endpoint inventory after SelectEmployees add-only refactor
Aaron's #1843 dropped the `removeEmployees` mutations from
SelectEmployeesHoliday and SelectEmployeesTimeOff (the add-only flow per
SDK-894), but the derived endpoint inventory wasn't regenerated. Picked up
by the pre-commit hook on this stacked PR.
No source change here — just the output of `build/deriveEndpointInventory.ts`.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: restore isHolidayPolicy prop on SelectEmployeesPresentation
When the SDK-894 branch was rebased onto main, the add-only SelectEmployees
components were checked out wholesale from the pre-rebase tip, which
predated Kristine's #1849 fix. That re-introduced the bug where the
description ternary keyed off `showReassignmentWarning` — meaning sick
and vacation policies (which often skip the reassignment warning) showed
the holiday description by mistake.
Reapply #1849's `isHolidayPolicy` prop:
- `SelectEmployeesPresentationTypes.ts`: add the prop
- `SelectEmployeesPresentation.tsx`: gate the description ternary on it
- `SelectEmployeesHoliday.tsx`: pass it
- stories: add a HolidayPolicy story
- tests: assert on `isHolidayPolicy` (and a default "renders description")
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: improve HolidayPolicyDetail pagination test reliability
Replace waitFor + getByText with findByText for pagination assertions
to make the test more robust in CI environments. findByText has built-in
retrying and better timeout handling for async state updates.
* fix: correct API mock format in HolidayPolicyDetail tests
The embedded-api expects:
- Array response (not wrapped in object)
- snake_case field names (auto-transformed to camelCase)
- Pagination headers (x-total-pages, x-total-count)
Also improved test reliability by using findByText instead of
waitFor + getByText for better async handling in CI environments.
* fix: use findByText for all async assertions in pagination test
Changed Person11 assertion to also use findByText for consistent
async handling across all pagination-related assertions.
* fix: improve HolidayPolicyDetail test isolation
- Move userEvent.setup() into beforeEach for proper test isolation
- Increase findByText timeout to 5000ms for pagination tests to handle
timing variations when running with full test suite
- Prevents test failures due to shared userEvent instance
* fix: use waitFor wrapper for findByText in pagination test
Wrap findByText in waitFor with explicit timeout to ensure proper
timing when navigating to second page in multi-test environment.
* fix: increase HolidayPolicyDetail pagination test timeout for CI
The pagination test timed out in CI (5s default) because Suspense
resolution + user interaction + state updates exceed that under load.
- Replace nested waitFor(findByText) antipattern with plain findByText
- Add explicit 15s test timeout to both pagination tests
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Jeffrey D Johnson <jeffredodd@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Kristine White <kristine.white@gusto.com>
Co-authored-by: Kristine White <kristinenicolemartin@gmail.com>
0 commit comments