Skip to content

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

Closed

Description

@gkhngyk

Problem

The dashboard Add a new brand flow (/dashboard/brands/new) has no recovery path when topic suggestion fails — reported twice from internal use. This flow is what invited team members (manager role) always use, since the first-signup onboarding is only shown once per account; #443 hardened the onboarding page but never touched this one.

Two defects, verified in web/src/app/[locale]/(dashboard)/dashboard/brands/new/page.tsx:

  1. No retry when topic suggestion fails. fetchTopicSuggestions catches the error, fires a generic toast (Failed to generate topic suggestions) and leaves the user on step 3 with an empty suggestion list. There is no Try again button and no hint that custom topics can be typed manually. Since the "Looks good" button is (correctly) disabled with 0 selected topics, the step becomes a dead end.
  2. The natural retry path creates a duplicate brand. Going Back to step 2 and pressing Continue calls handleCreateBrand, which runs createBrand unconditionally — even when createdBrand is already set. Every Back→Continue round-trip inserts another brand row.

Note the step-skipping side is already safe: step 3 requires ≥1 selected topic and step 4 requires ≥1 prompt before continuing. The problem is not that users can skip — it's that they can't move at all when the suggestion call fails.

Fix

Port the #443 treatment from the onboarding page to this flow:

  • On topic-suggestion failure, show an inline error banner with a "Try again" button (same amber pattern as web/src/app/[locale]/(onboarding)/dashboard/onboarding/page.tsx), plus copy pointing at the "Add custom topic" input as the manual fallback. Replace the toast-only handling.
  • Apply the same banner + Try again to the competitor-suggestion failure on step 5 for consistency (less severe today — the user can already add manually and finish — but it currently gets the same silent toast).
  • Make Back→Continue idempotent: when createdBrand is already set, handleCreateBrand must not create a second brand — update the existing brand's fields (name, description, region, language, domains) if they changed, then advance to step 3.

Prompt generation (step 3 → 4) already has an implicit retry: the user stays on step 3 and can press "Looks good" again, and createTopics is idempotent (delete + insert). No change needed there beyond keeping the button enabled after failure.

Acceptance criteria

  • Topic suggestion failure shows an inline banner with Try again; retrying re-runs the suggestion call without leaving the step, and manual topic entry is offered as a fallback.
  • Competitor suggestion failure on step 5 gets the same banner + Try again.
  • Back→Continue from step 2 never creates a second brand: the flow reuses (and updates) the brand created on the first pass.
  • Step gating is unchanged: no advancing past step 3 with 0 topics or past step 4 with 0 prompts.

Activity

  1. added
    bug
    on Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions