Skip to content

fix(onboarding): don't seed a demo flag into a project that has flags - #8217

Draft
talissoncosta wants to merge 1 commit into
mainfrom
fix/onboarding-skip-flag-creation-existing-project
Draft

fix(onboarding): don't seed a demo flag into a project that has flags#8217
talissoncosta wants to merge 1 commit into
mainfrom
fix/onboarding-skip-flag-creation-existing-project

Conversation

@talissoncosta

@talissoncosta talissoncosta commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Visiting /getting-started created show_demo_button in whichever project came back first, whether or not the customer had ever onboarded. Features are project-level, so it showed up in every environment of that project including production, next to a new Onboarding tag. The Getting Started link in TopNavbar.tsx is ungated, so any customer could trigger it by clicking it.

The rule now lives in demoFlag.ts as two pure functions, findDemoFlag and shouldSeedDemoFlag, with unit tests. It was inline in an async orchestrator that nothing could test, and it is now customer-visible enough to be worth pinning. An empty project still gets the demo flag, an established one gets nothing, and a project that already ran the tour reuses its flag, matched by tag first since a rename is a delete and recreate.

That leaves the tour with no flag to teach with, so the page says so and links to the project's own flags rather than walking someone through connecting a project that is already connected.

The copy and treatment of that state are provisional and the part worth reviewing. It currently reuses the same centred layout as the existing error state, and deliberately renders no header, since the header offers inline renames of the org and project, which is not something to put in front of a customer who wandered in.

Not in scope, both worth doing next:

  • Creation still happens on page load, so visiting a URL mutates data. Moving it behind an explicit action would remove this class of problem rather than guarding it.
  • There is still no durable "this account has onboarded" state. isGettingStarted is set once at register (account-store.js:311), lives in memory, and is lost on refresh, which is why the nav link can't honour "keep it until the user completes onboarding".

How did you test this code?

  • typecheck clean for the touched files (the onboarding errors that remain are the pre-existing missing storybook types in story files, present on main)
  • test:unit (394, including 6 new for the seeding rule) and lint clean
  • Checked the new tests aren't vacuous: made shouldSeedDemoFlag always return true, watched the suite fail, reverted

Manual pass, both paths:

  • Brand-new account: /getting-started still creates show_demo_button, tags it, and the tour works end to end
  • Account with an existing project containing flags: no flag is created, no Onboarding tag appears, and the page shows the already-set-up state
  • Existing project that already has the demo flag (tagged or named): it is reused, not duplicated
  • Empty project on an established account: still seeds the flag, since there is nothing to clutter

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview Aug 4, 2026 2:10pm
flagsmith-frontend-staging Ready Ready Preview Aug 4, 2026 2:10pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Aug 4, 2026 2:10pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a5c8e0c3-f608-4a6d-adfb-99fbc5eb6294

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Visiting /getting-started created show_demo_button in whichever project came
back first, whether or not the customer had ever onboarded. Features are
project-level, so it appeared in every environment of that project, including
production, alongside a new Onboarding tag. The Getting Started nav link is
ungated, so any customer could trigger this by clicking it.

ensureFlag already computed isFirstFeature for analytics; it now also decides
whether to create anything. An empty project still gets the demo flag, an
established one gets nothing.

That leaves the tour with no flag to teach with, so the page says so and points
at the project's own flags instead of walking someone through connecting a
project that is already connected.

Copy and treatment of that state are provisional.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant