Skip to content

fix(gp): merge initialValues with saved step values in admin steps#1172

Merged
remotecom merged 1 commit into
mainfrom
fix/gp-admin-step-defaultvalues-merge
Jul 17, 2026
Merged

fix(gp): merge initialValues with saved step values in admin steps#1172
remotecom merged 1 commit into
mainfrom
fix/gp-admin-step-defaultvalues-merge

Conversation

@hamzaremote

@hamzaremote hamzaremote commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

What

Follow-up flagged during the employee-flow review (#1168): the admin flow's step components used stepState.values?.<step> || initialValues?.<step> for defaultValues. useStepState stores an empty {} when the user advances without editing prefilled data (since useJSONSchemaForm only syncs on watch-detected changes), and {} is truthy — so it won over initialValues and blanked the form on revisit.

Fix

Switched SelectCountryStep, ContractDetailsStep, and AdministrativeDetailsStep to a merge: { ...initialValues[step], ...stepState.values[step] }initialValues is the base, genuine edits override. Same fix already applied to the employee flow in #1168.

Verification

type-check ✅ · oxfmt ✅ · oxlint ✅

🤖 Generated with Claude Code


Note

Low Risk
Localized form default-value logic in three admin onboarding step components; no auth, API, or data-model changes.

Overview
Fixes payroll admin onboarding steps that blanked prefilled fields when users navigated back after advancing without editing.

defaultValues no longer uses stepState.values?.<step> || initialValues?.<step>. Advancing without edits can persist an empty {} in step state, which is truthy and previously replaced real initialValues. The three affected steps now spread-merge prefills first and saved step values on top: SelectCountryStep, ContractDetailsStep, and AdministrativeDetailsStep (same pattern as the employee flow in #1168).

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

Mirror the employee-flow fix: an empty {} saved by useStepState after advancing
without edits is truthy and would win over initialValues via ||, blanking the
form on revisit. Merge instead — initialValues as base, saved edits override.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 242.11 kB 242.11 kB +7 B (+0.0%) 🔴
Total (raw) 648.74 kB 648.72 kB +21 B (+0.0%) 🔴
CSS (gzip) 21.45 kB 21.45 kB 0 B (0%) 🟢
CSS (raw) 110.5 kB 110.5 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 242.11 kB / 250 kB (96.8%)
  • ✅ Total raw: 648.74 kB / 650 kB (99.8%)
  • ✅ CSS gzipped: 21.45 kB / 25 kB (85.8%)

Largest Files (Top 5)

  1. chunk-Y3CJRZLA.js - 14 kB (0 B (0%))
  2. styles.css - 10.73 kB (0 B (0%))
  3. index.css - 10.73 kB (0 B (0%))
  4. index.js - 6.49 kB (0 B (0%))
  5. chunk-UCTUH2PW.js - 6.44 kB (0 B (0%))
View All Files (381 total)
File Size (gzip) Change
chunk-Y3CJRZLA.js 14 kB 0 B (0%)
styles.css 10.73 kB 0 B (0%)
index.css 10.73 kB 0 B (0%)
index.js 6.49 kB 0 B (0%)
chunk-UCTUH2PW.js 6.44 kB 0 B (0%)
chunk-AS7SJDU5.js 6.4 kB 0 B (0%)
chunk-G2LZFGZA.js 5.31 kB 0 B (0%)
chunk-SMBGLI65.js 4.86 kB 0 B (0%)
chunk-CG6HX6UO.js 4.76 kB 0 B (0%)
chunk-LSC6NTXD.js 3.89 kB 0 B (0%)

✅ Bundle size check passed

@github-actions

Copy link
Copy Markdown
Contributor

📊 Coverage Report

✅ Coverage increased! 🎉

Metric Current Previous Change Status
Lines 83.37% 83.37% 0%
Statements 82.75% 82.75% 0%
Functions 81.32% 81.32% 0%
Branches 75.52% 75.38% +0.14% 🟢

Detailed Breakdown

Lines Coverage
  • Covered: 3971 / 4763
  • Coverage: 83.37%
  • Change: 0% (0 lines)
Statements Coverage
  • Covered: 4035 / 4876
  • Coverage: 82.75%
  • Change: 0% (0 statements)
Functions Coverage
  • Covered: 1071 / 1317
  • Coverage: 81.32%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 2474 / 3276
  • Coverage: 75.52%
  • Change: +0.14% (0 branches)

✅ Coverage check passed

@github-actions

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-2hvtm3bv3-remotecom.vercel.app
Latest Commit:3e6ecdf

Deployed with vercel-action

@github-actions

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

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

Deployed with vercel-action

@remotecom
remotecom merged commit 31b4b65 into main Jul 17, 2026
11 checks passed
@remotecom
remotecom deleted the fix/gp-admin-step-defaultvalues-merge branch July 17, 2026 14:04
@gabrielseco gabrielseco mentioned this pull request Jul 17, 2026
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.

3 participants