Skip to content

fix(brands): recover from suggestion failures and stop Back/Continue duplicating brands - #467

Merged
gkhngyk merged 1 commit into
mainfrom
fix/brands-new-error-recovery
Jul 17, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
fix/brands-new-error-recovery

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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 createBrand unconditionally 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:

  • Topic suggestion failure (step 3): amber inline banner with a Try again button, plus copy pointing at the custom-topic input as the manual fallback. Replaces the toast-only handling.
  • Competitor suggestion failure (step 5): same banner + Try again, pointing at the manual add inputs.
  • Back→Continue no longer duplicates the brand: once createdBrand exists, re-submitting step 2 updates the brand in place — updateBrand (extended with region/language support) — and syncs the domain row via syncDomains only when the website actually changed. The brand store is updated so the brand switcher reflects edits immediately.
  • Step gating unchanged: still no advancing past step 3 with 0 topics or past step 4 with 0 prompts.

Related issue

Closes #447

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Stop the aeo-server, then Dashboard → Brands → Add a new brand → fill steps 1–2 → Continue.
  2. Step 3 shows the amber banner (no toast); start the server and hit Try again → suggestions load; the custom-topic input works as fallback throughout.
  3. From step 3 go Back → Continue again: the Brands list still has one brand, and any field changed on steps 1–2 (e.g. region) is reflected on it.
  4. Repeat the failure scenario on step 5 → same banner; Try again recovers; manual competitor add still works.
  5. Gating: with 0 selected topics "Looks good" stays disabled; with 0 prompts step 4's Continue stays disabled.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

…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
@gkhngyk
gkhngyk merged commit 267ccda into main Jul 17, 2026
5 checks passed
@gkhngyk
gkhngyk deleted the fix/brands-new-error-recovery branch July 17, 2026 21:38
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.

Add-a-new-brand flow: dead end when topic suggestion fails + Back/Continue creates a duplicate brand

1 participant