feat: require cancelling self-onboarding before editing a contractor#2407
Merged
serikjensen merged 5 commits intoJul 15, 2026
Merged
Conversation
While a contractor is mid self-onboarding (invited or started), the list menu no longer offers "Edit" — only "Cancel self-onboarding" and "Delete" remain, so the admin must cancel self-onboarding to regain edit access. Also drop the Edit/Review-specific hamburger trigger label in favor of the default "Open menu" accessible label, since the trigger only opens the menu. Co-authored-by: Cursor <cursoragent@cursor.com>
When contractors complete self-onboarding and sign their W-9, hide the manual W-9 collection instructions on the Submit screen since the document is already on file. Introduces useContractorHasSignedW9 hook to check if a contractor has a signed W-9 document, then conditionally renders the documents section based on that check. Co-authored-by: Cursor <cursoragent@cursor.com>
serikjensen
commented
Jul 14, 2026
Comment on lines
+1
to
+14
| import { useContractorDocumentsGetAllSuspense } from '@gusto/embedded-api/react-query/contractorDocumentsGetAll' | ||
| import { isW9Document } from '@/components/Contractor/Documents/SignatureForm/useContractorSignatureForm' | ||
|
|
||
| /** | ||
| * Returns `true` when the contractor has a W-9 with a `signedAt` timestamp on | ||
| * file. Fetches via Suspense — must be rendered inside a Suspense boundary | ||
| * (SDK `BaseBoundaries` supplies one). | ||
| * | ||
| * @internal | ||
| */ | ||
| export function useContractorHasSignedW9(contractorId: string): boolean { | ||
| const { data } = useContractorDocumentsGetAllSuspense({ contractorUuid: contractorId }) | ||
| return (data.documents ?? []).some(doc => isW9Document(doc) && !!doc.signedAt) | ||
| } |
Member
Author
There was a problem hiding this comment.
Note: this is an abstraction that we're using in this PR #2394 whoever merges first will rebase and get it.
Member
Author
|
@cursoragent please fix the test failures here |
|
Perfect! I've successfully fixed all the test failures in Issues FoundThe test mocks were using incorrect API response formats:
Changes Made
All 3 tests in |
- Remove incorrect wrapper keys (contractor, contractor_onboarding_status, documents)
- API responses should be flat objects or arrays, not wrapped
- Add PDF document mock handler for document fetching
- Update test assertions to match actual rendered text ('Documents' not 'Document Requirements')
The contractor list menu trigger now uses 'Open menu' as the accessible label instead of 'Edit', matching the PR changes that dropped the Edit/Review-specific trigger labels.
krisxcrash
approved these changes
Jul 15, 2026
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
self_onboarding_invitedorself_onboarding_started), the contractor list action menu no longer offers Edit — only Cancel self-onboarding and Delete remain. The admin must cancel self-onboarding to regain edit access, preventing edits to a profile the contractor is actively filling out.Notes
mainviaSubmit.tsx's dynamicdocumentsToCollectfiltering (requiresSigning && !signedAt), so no change was needed there.Test plan
npm run test -- --run src/components/Contractor/ContractorList/ContractorList.test.tsx(10 passing)self_onboarding_invited/self_onboarding_startedself_onboarding_review) for all other statusesScreen.Recording.2026-07-14.at.4.32.37.PM.mov
Screen.Recording.2026-07-14.at.4.34.10.PM.mov
Screen.Recording.2026-07-14.at.4.34.48.PM.mov
Made with Cursor