fix(checkout): CHECKOUT-10180 Initialize checklist formik with correct value#3143
Open
bc-maxy wants to merge 2 commits into
Open
fix(checkout): CHECKOUT-10180 Initialize checklist formik with correct value#3143bc-maxy wants to merge 2 commits into
bc-maxy wants to merge 2 commits into
Conversation
Contributor
Author
|
cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 a9e2487. Configure here.
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.

What/Why?
This PR fixes the issue when a checkout page is rendered without pre-selected shipping method even though it comes as selected through our initial state.
The issue is that Checklist forwards
defaultSelectedItemIdto Accordion for visual pre-selection, but never syncs that value into its own Formik field.Fix: the existing useEffect that runs on mount and unmount now also seeds the Formik field with
defaultSelectedItemIdon mount, if present.This Checklist component is also used by Payment method selection, but this PR should not make any difference there. In Payment method selection
defaultSelectedItemIdcomes from Formik, so setting it on mount will be a no-op.Added tests covering both the seeded and empty-default cases.
Rollout/Rollback
Revert the PR.
Testing
New CI tests + manual testing:
Before
Screen.Recording.2026-07-07.at.2.07.26.PM.mov
After
Screen.Recording.2026-07-07.at.2.12.47.PM.mov
Note
Low Risk
Small UI form sync change in a shared component; payment paths are expected to be no-ops when the value already comes from Formik.
Overview
Fixes checkout shipping (and similar checklist UIs) where the accordion looked pre-selected but the Formlist/Formik field stayed empty because
defaultSelectedItemIdwas only passed toAccordion, not written into Formik.On mount, the existing cleanup
useEffectnow also callssetFieldValue(name, defaultSelectedItemId)when that prop is set, so initial server/checkout state matches the form value. Unmount still clears the field. Payment flows that already derive the default from Formik should behave the same.Reviewed by Cursor Bugbot for commit a9e2487. Bugbot is set up for automated code reviews on this repo. Configure here.