Skip to content

fix(onboarding): refetch employment after basic info - #1515

Closed
gabrielseco wants to merge 4 commits into
mainfrom
fix/onboarding-refetch-employment-after-basic-info
Closed

gabrielseco wants to merge 4 commits into
mainfrom
fix/onboarding-refetch-employment-after-basic-info

Conversation

@gabrielseco

@gabrielseco gabrielseco commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

If an employer changes the job title in Onboarding and continues, the job title eligibility check now runs against the new title instead of the one loaded when the flow opened.

Why

  • Onboarding never refetched the employment after saving basic information, so the cached employment kept the old job title for the rest of the session.
  • The job title eligibility check (feat(onboarding): show job title eligibility statements for maybe and not eligible roles #1508) reads the title from that employment, so after an in-session title change it checked the old title. On submit, the API checks the verdict against the current title, so a check for the old title no longer matches.
  • Refetching keeps the employment as the single source of truth instead of patching the title in from local step state. It also picks up anything the API recalculated on its side after the update.

What changed

Toggle details
  • hooks.tsx: in the basic information update path, refetch the employment after a successful update and before moving to the next step. The update resolves with { data, error } instead of throwing, so the refetch is skipped explicitly when it failed. The create path is unchanged, since it sets a new employment id, which fetches fresh anyway.
  • Tests:
    • OnboardingFlowJobTitleEligibility.test.tsx, on jsf v0 and v1: type a new title in Basic information and continue, using the real basic information fixture. The flow stays on the step until the refetch finishes, then the check sends the new title.
    • OnboardingFlow.test.tsx: a failed update stays on Basic information and doesn't refetch.
    • The existing tests in those files already cover both submit payloads, so the new tests don't repeat them.
  • No public API change. It costs one extra GET per successful basic information save.

Screenshots

N/A

Related Resources

Testing

Each new test was checked by removing the code it covers:

Change removed Result
await refetchEmployment() the check sends "Software Engineer" instead of "Surgeon" (v0 and v1)
await → void refetchEmployment() contract details renders before the refetch finishes
!response.error guard a failed update triggers an extra employment GET
  • Tested against the example/ app in a browser
  • Feature flag: job_title_eligibility for the check. The refetch itself isn't behind a flag.

🤖 Generated with Claude Code


Note

Low Risk
Localized onboarding submit-path change with a refetch after an existing update; adds one GET per basic info save and is covered by a new test.

Overview
Fixes a session bug where job title eligibility on contract details used a stale job title after the user edited basic information in the same onboarding session.

After a successful basic information PATCH, the flow now awaits refetchEmployment() so cached employment (including job_title) matches what was saved before the user continues. The create-employment path is unchanged.

A new integration test walks basic information → contract details, changes the title mid-session, and asserts the eligibility check payload uses the updated title (it would still send the old title without the refetch). Expect one extra GET per basic info save; no API contract changes.

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

The flow never refetched the employment after updating basic
information, so the job title eligibility check kept sending the old
job title after an in-session title change. Refetch before moving on so
the employment query stays the single source of truth.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 230.49 kB 230.47 kB +15 B (+0.0%) 🔴
Total (raw) 641.96 kB 641.93 kB +35 B (+0.0%) 🔴
CSS (gzip) 21.94 kB 21.94 kB 0 B (0%) 🟢
CSS (raw) 114.43 kB 114.43 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 230.49 kB / 350 kB (65.9%)
  • ✅ Total raw: 641.96 kB / 850 kB (75.5%)
  • ✅ CSS gzipped: 21.94 kB / 25 kB (87.8%)

Largest Files (Top 5)

  1. index.esm-wIkXrqU6.js - 11.4 kB (0 B (0%))
  2. styles.css - 10.97 kB (0 B (0%))
  3. index.css - 10.97 kB (0 B (0%))
  4. internals-D6148AAY.js - 6.13 kB (0 B (0%))
  5. hooks-ThU7CDLI.js - 5.85 kB (0 B (0%))
View All Files (291 total)
File Size (gzip) Change
index.esm-wIkXrqU6.js 11.4 kB 0 B (0%)
styles.css 10.97 kB 0 B (0%)
index.css 10.97 kB 0 B (0%)
internals-D6148AAY.js 6.13 kB 0 B (0%)
hooks-ThU7CDLI.js 5.85 kB 0 B (0%)
sdk.gen-BRPiw4M1.js 5.58 kB 0 B (0%)
index.js 5.51 kB 0 B (0%)
flows/Onboarding/hooks.js 4.67 kB +15 B (+0.3%)
utils-CUgvJHl4.js 4.07 kB 0 B (0%)
FieldSetField-QbfQb5Lp.js 4.04 kB 0 B (0%)

✅ Bundle size check passed

@github-actions

github-actions Bot commented Oct 12, 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-ko804c1sw-remotecom.vercel.app
Latest Commit:51da3a0

Deployed with vercel-action

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

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

Deployed with vercel-action

@gabrielseco gabrielseco self-assigned this Oct 12, 2026
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

📊 Coverage Report

⚪ Coverage unchanged

Metric Current Previous Change Status
Lines 89.53% 89.53% 0% ⚪
Statements 89.41% 89.40% 0% ⚪
Functions 88.41% 88.41% 0% ⚪
Branches 81.15% 81.14% 0% ⚪

Detailed Breakdown

Lines Coverage
  • Covered: 5388 / 6018
  • Coverage: 89.53%
  • Change: 0% (3 lines)
Statements Coverage
  • Covered: 5453 / 6099
  • Coverage: 89.41%
  • Change: 0% (3 statements)
Functions Coverage
  • Covered: 1426 / 1613
  • Coverage: 88.41%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 3341 / 4117
  • Coverage: 81.15%
  • Change: 0% (2 branches)

✅ Coverage check passed

gabrielseco and others added 3 commits October 12, 2026 13:44
Type the new title into basic information and continue, with the
update handler storing the title it receives, instead of calling the
flow's submit directly with a handler that ignored the payload.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Serve basicInformationSchemaV1Portugal instead of a hand-built schema,
and render the steps only once the flow has loaded so the form starts
from the saved employment.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The update resolves with an error instead of throwing, so the refetch
also ran after a failed save. Guard it, and test that a failed update
stays on the step without refetching, and that a successful one only
moves on once the refetch has finished.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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