Skip to content

feat(preonboardings-requirements) - make employment readonly when shouldFreezeEmploymentData is true - #1213

Open
gabrielseco wants to merge 13 commits into
mainfrom
fix-preonboardings-freeze
Open

feat(preonboardings-requirements) - make employment readonly when shouldFreezeEmploymentData is true #1213
gabrielseco wants to merge 13 commits into
mainfrom
fix-preonboardings-freeze

Conversation

@gabrielseco

@gabrielseco gabrielseco commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

When a user ack a requirement or signs one, the shouldFreezeEmploymentData that comes from the preonboarding-requirements endpoint changes and it should not make able to edit the employment anymore

This code presented here makes that happen but there were needed some more changes to not break create reserves as it was coupled with isEmploymentReadOnly

Note

Medium Risk
Changes invite/reserve branching and when employment is read-only during onboarding, which can affect who can edit data or click invite before async requirements load.

Overview
Pre-onboarding requirements with freeze_employment_data now lock employment editing and auto-route users to Review, same as late-stage employment statuses.

useOnboarding derives shouldFreezeEmploymentData from requirements, folds it into isEmploymentReadOnly, and keeps the flow in a loading state until pre-onboarding requirements (and onboarding reserves status) finish loading. canInvite no longer blocks on reserves loading; unfinished requirements still block invite via arePreOnboardingRequirementsFulfilled.

OnboardingInvite uses shared statusesWithReserveAlreadyHandled instead of readonly employment to decide reserve vs invite, and only creates a reserve invoice when canInvite is true. Tests cover freeze navigation and updated invite loading behavior.

Reviewed by Cursor Bugbot for commit baa0df5. Bugbot is set up for automated code reviews on this repo. Configure here.

@gabrielseco gabrielseco self-assigned this Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 250.33 kB 250.19 kB +133 B (+0.1%) 🔴
Total (raw) 670.88 kB 670.55 kB +332 B (+0.0%) 🔴
CSS (gzip) 21.69 kB 21.69 kB 0 B (0%) 🟢
CSS (raw) 112.77 kB 112.77 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 250.33 kB / 350 kB (71.5%)
  • ✅ Total raw: 670.88 kB / 850 kB (78.9%)
  • ✅ CSS gzipped: 21.69 kB / 25 kB (86.8%)

Largest Files (Top 5)

  1. chunk-4FGKIGKF.js - 14 kB (0 B (0%))
  2. styles.css - 10.85 kB (0 B (0%))
  3. index.css - 10.85 kB (0 B (0%))
  4. index.js - 6.68 kB (-2 B (-0.0%))
  5. chunk-XI55YG73.js - 6.45 kB (0 B (0%))
View All Files (402 total)
File Size (gzip) Change
chunk-4FGKIGKF.js 14 kB 0 B (0%)
styles.css 10.85 kB 0 B (0%)
index.css 10.85 kB 0 B (0%)
index.js 6.68 kB -2 B (-0.0%)
chunk-XI55YG73.js 6.45 kB 0 B (0%)
chunk-TFGSVHR6.js 6.44 kB new
chunk-NXRWBI36.js 5.31 kB 0 B (0%)
chunk-AAOU5HS2.js 4.86 kB new
chunk-KBDRU6SO.js 4.76 kB 0 B (0%)
chunk-A5VJNO74.js 4.22 kB new

✅ Bundle size check passed

Comment thread src/flows/Onboarding/hooks.tsx
Comment thread src/flows/Onboarding/hooks.tsx
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage Report

✅ Coverage increased! 🎉

Metric Current Previous Change Status
Lines 85.01% 84.99% +0.01% 🟢
Statements 84.49% 84.47% +0.01% 🟢
Functions 82.99% 82.98% +0.01% 🟢
Branches 76.41% 76.40% +0.01% 🟢

Detailed Breakdown

Lines Coverage
  • Covered: 4110 / 4835
  • Coverage: 85.01%
  • Change: +0.01% (4 lines)
Statements Coverage
  • Covered: 4177 / 4944
  • Coverage: 84.49%
  • Change: +0.01% (4 statements)
Functions Coverage
  • Covered: 1103 / 1329
  • Coverage: 82.99%
  • Change: +0.01% (1 functions)
Branches Coverage
  • Covered: 2579 / 3375
  • Coverage: 76.41%
  • Change: +0.01% (2 branches)

✅ Coverage check passed

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Deploy preview for adp-cost-calculator ready!

Project:adp-cost-calculator
Status: ✅  Deploy successful!
Preview URL:https://adp-cost-calculator-fgo2v6jtw-remotecom.vercel.app
Latest Commit:baa0df5

Deployed with vercel-action

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-q65goqhl0-remotecom.vercel.app
Latest Commit:d4f935a

Deployed with vercel-action

Comment thread src/flows/Onboarding/tests/OnboardingInvite.test.tsx
Comment thread src/flows/Onboarding/components/OnboardingInvite.tsx

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 110942d. Configure here.

Comment thread src/components/form/validationResolver.ts Outdated
@gabrielseco gabrielseco changed the title Fix preonboardings freeze feat(preonboardings-requirements) - make employment readonly when shouldFreezeEmploymentData is true Aug 3, 2026
});

it('should keep button disabled during requirements loading to prevent race condition', async () => {
let resolveRequirements: (value: unknown) => void;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplified the test

isLoadingEmploymentAgreementPreview ||
isLoadingContractDetailsFormV1;
isLoadingContractDetailsFormV1 ||
isLoadingPreOnboardingRequirements ||

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we were missing some loadings here

employmentStatus &&
!disabledInviteButtonEmploymentStatus.includes(employmentStatus) &&
arePreOnboardingRequirementsFulfilled &&
!isLoadingOnboardingReservesStatus;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loading not needed here as we put it in the initialLoading

isDepositRequired &&
onboardingBag.employmentId &&
onboardingBag.employment?.status &&
!onboardingBag.isEmploymentReadOnly

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we cannot rely anymore on the employment being readonly because that would mean that you cannot create a reserve if a preonboarding requirement has shouldFreezeEmploymentData

@gabrielseco
gabrielseco requested a review from cammellos August 3, 2026 15:39
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.

1 participant