Skip to content

perf(Onboarding): Create the demo setup in parallel for new organisations - #9200

Open
talissoncosta wants to merge 1 commit into
mainfrom
perf/onboarding-parallel-setup
Open

talissoncosta wants to merge 1 commit into
mainfrom
perf/onboarding-parallel-setup

Conversation

@talissoncosta

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

The onboarding demo setup ran 14 API calls one after another. On staging that took 7.3s for a new sign-up (prod median is over 6s, worst case 49s).

For a new organisation, bootstrapOnboarding now:

  • skips the project, flag and tag lookups, since a new organisation has none
  • creates both environments and the Onboarding tag in parallel
  • creates the flag with the tag attached, so there's no follow-up tag lookup or flag update

The flag still waits for both environments, so neither environment can miss the flag's state. Users who already have a project take the same path as before.

On staging: 14 steps down to 5, 7.3s down to 3.4s.

How did you test this code?

  • Unit tests pass.
  • Two fresh sign-ups on localhost:8080 against the staging API, on the single_page variant:
    • setup takes about 3.4s
    • first evaluation shows "Connected"
    • the flag has the Onboarding tag
    • toggling the flag reaches the SDK

@vercel

vercel Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
flagsmith-frontend-preview Ready Ready Preview Nov 30, 2026 4:26pm UTC
flagsmith-frontend-staging Ready Ready Preview Nov 30, 2026 4:26pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
docs Ignored Ignored Nov 30, 2026 4:26pm UTC

Request Review

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-9200 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-9200 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-9200 Finished ✅ Results ✅
ghcr.io/flagsmith/flagsmith:pr-9200 Finished ✅ Results ✅
ghcr.io/flagsmith/flagsmith-private-cloud:pr-9200 Finished ✅ Results ✅
ghcr.io/flagsmith/flagsmith-frontend:pr-9200 Finished ✅ Results ✅

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 3/5

  • bootstrapOnboarding.ts can leave a Production project behind when Development creation fails; on reload, the retry may reuse that project and fall back to its first environment. Make the bootstrap retry-safe or clean up the partial creation on failure.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="frontend/web/components/pages/onboarding/hooks/bootstrapOnboarding.ts">

<violation number="1" location="frontend/web/components/pages/onboarding/hooks/bootstrapOnboarding.ts:149">
P2: If Development creation fails after Production succeeds, `Promise.all` rejects but leaves Production behind. Reload retries against that project, and `ensureEnvironments` falls back to its first environment, so the SDK sample receives a Production key; make recovery guarantee Development before returning an environment.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

.unwrap()
return project
API.trackEvent(Constants.events.CREATE_FIRST_PROJECT)
const [environment, , tag] = await Promise.all([

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: If Development creation fails after Production succeeds, Promise.all rejects but leaves Production behind. Reload retries against that project, and ensureEnvironments falls back to its first environment, so the SDK sample receives a Production key; make recovery guarantee Development before returning an environment.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At frontend/web/components/pages/onboarding/hooks/bootstrapOnboarding.ts, line 149:

<comment>If Development creation fails after Production succeeds, `Promise.all` rejects but leaves Production behind. Reload retries against that project, and `ensureEnvironments` falls back to its first environment, so the SDK sample receives a Production key; make recovery guarantee Development before returning an environment.</comment>

<file context>
@@ -69,47 +70,94 @@ async function ensureOrganisation(
     .unwrap()
-  return project
+  API.trackEvent(Constants.events.CREATE_FIRST_PROJECT)
+  const [environment, , tag] = await Promise.all([
+    createEnvironment(store, project.id, DEV_ENVIRONMENT_NAME),
+    createEnvironment(store, project.id, PROD_ENVIRONMENT_NAME),
</file context>

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #24092 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  36 seconds
commit  676e9e7
info  🔄 Run: #24092 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-16 — run #24092 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  7 passed

Details

stats  7 tests across 6 suites
duration  6.8 seconds
commit  676e9e7
info  🔄 Run: #24092 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #24092 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  34.7 seconds
commit  676e9e7
info  🔄 Run: #24092 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #24092 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  31.1 seconds
commit  676e9e7
info  🔄 Run: #24092 (attempt 1)

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

31 screenshots compared. See report for details.
View full report

This branch was successfully deployed

2 active deployments
Preview – flagsmith-frontend-staging — 676e9e7d Deployed Nov 30, 2026 by vercel[bot]
Preview – flagsmith-frontend-preview — 676e9e7d Deployed Nov 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant