Repository navigation
fix(brands): recover from suggestion failures and stop Back/Continue duplicating brands - #467
Merged
Merged
Conversation
…duplicating brands The Add-a-new-brand flow had no recovery path when topic suggestion failed: a transient toast, an empty suggestion list, and a disabled continue button left the user stranded on step 3. Worse, the natural retry — Back to step 2, Continue again — called createBrand unconditionally and inserted a duplicate brand on every round-trip. - Topic and competitor suggestion failures now show the onboarding-style amber inline banner with a Try again button (#443 pattern) plus copy pointing at the manual input as the fallback, replacing the toasts. - handleCreateBrand is idempotent: once createdBrand exists, re-submitting step 2 updates the brand in place (updateBrand, extended with region/language) and syncs the domain row only when the website actually changed (syncDomains), then advances. The brand store is updated so the switcher reflects edits immediately. Step gating is unchanged: no advancing past step 3 with 0 topics or past step 4 with 0 prompts. Closes #447
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
The dashboard Add-a-new-brand flow had no recovery path when topic suggestion failed — reported twice from internal use. A transient toast, an empty suggestion list, and a (correctly) disabled continue button left the user stranded on step 3. Worse, the natural retry — Back to step 2, Continue again — called
createBrandunconditionally and inserted a duplicate brand on every round-trip.This PR ports the #443 onboarding treatment to this flow and makes the step-2 submit idempotent:
createdBrandexists, re-submitting step 2 updates the brand in place —updateBrand(extended withregion/languagesupport) — and syncs the domain row viasyncDomainsonly when the website actually changed. The brand store is updated so the brand switcher reflects edits immediately.Related issue
Closes #447
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)