Skip to content

feat(SDK-1191): add unstable hook-backed payroll history - #2880

Open
krisxcrash wants to merge 3 commits into
mainfrom
kw/feat/SDK-1191
Open

krisxcrash wants to merge 3 commits into
mainfrom
kw/feat/SDK-1191

Conversation

@krisxcrash

@krisxcrash krisxcrash commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a hook-backed PayrollHistory implementation behind the payrollHistoryHooks unstable feature flag. The flag defaults to off, preserving the existing component behavior while the migration is reviewed.

Changes

  • Extract historical payroll fetching, filters, pagination, and cancellation into internal usePayrollHistory, following the existing UNSTABLE_PayrollEditEmployee pattern.
  • Return plain payroll API rows and wire requests; both implementations derive row values through the same presentation helper. Share and validate payroll identifiers before exposing row actions.
  • Run the cancellation success callback inside submit error handling, so synchronous callback exceptions reach a React boundary and produce a failed submit metric.
  • Preserve event payloads, dictionary overrides, custom loading/error components, and cached wire data after background refresh failures.
  • Remove duplicate history/empty stories, rename the error story to QueryError, and remove the unused status.isFetching field.
  • Add legacy/hook parity coverage and Storybook scenarios matching the original history stories, plus loading, query errors, cancellation errors, and pagination.

Error boundary behavior

Query behavior matches legacy: payroll query errors reach the component boundary, initial wire-query errors reach it, and cached wire refresh errors remain invisible in the component. Headless consumers receive query errors through errorHandling.

Unexpected cancellation callback errors follow each implementation's boundary placement: legacy handles them at its outer boundary; the hooks implementation handles them at its component boundary and emits ERROR with the raw exception. Both record a failed submit metric. Regression coverage asserts this distinction explicitly.

Related

Testing

  • 159 targeted tests pass, including 72 legacy/hook component and behavior cases. Coverage includes callback exceptions, missing payroll IDs, initial query retry, and cached wire refresh failures.
  • TypeScript, production build, formatting, ESLint, and documentation build pass. ESLint reports existing warnings.
  • Previous full-suite run: 4,302 passed, one expected failure, and one failure in the unchanged contractor CreatePayment tests. That file's 19 tests passed on isolated rerun.
  • Manually verified the hooks stories in Storybook: all 11 status examples, successful cancellation, empty/loading/query-error states, cancellation errors, pagination, and date filtering/reset.

To review, run npm run storybook and open Domain / Payroll / UNSTABLE_PayrollHistory. Compare PayrollHistoryStory, AllStatusesShowcase, CancelDialog, EmptyState, and WithDateFilter with the original stories. To exercise the public component's hook path, set unstableFeatures={{ payrollHistoryHooks: true }} on GustoProvider.

@krisxcrash
krisxcrash requested a review from a team as a code owner October 7, 2026 22:01

@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.

Put a parking lot item on the schedule to discuss hooks direction! mentioned that i'm hesitant to roll these out given we are entering the partner stabilization phase

This branch has not been deployed

No deployments
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