Skip to content

fix(dashboard): keep the onboarding plan step up during a billing refetch - #1111

Closed
FindMalek wants to merge 5 commits into
databuddy-analytics:izadoesdev/onboarding-plan-step-releasefrom
FindMalek:fix/onboarding-plan-step-reload-flash
Closed

FindMalek wants to merge 5 commits into
databuddy-analytics:izadoesdev/onboarding-plan-step-releasefrom
FindMalek:fix/onboarding-plan-step-reload-flash

Conversation

@FindMalek

@FindMalek FindMalek commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1096, stacked on izadoesdev/onboarding-plan-step-release so this diff is just the fix.

Bug

offersPlans requires !billing.isLoading before ChoosePlan renders:

const offersPlans =
	!(isSelfHosted || isDashboardE2E || billing.isLoading || billing.isError) &&
	billing.canUserUpgrade &&
	isOn("onboarding-plan-step");

if (step === "plan" && websiteId && offersPlans) {
	return <ChoosePlan ... />;
}

On a hard reload while sitting on ?step=plan (e.g. returning from Stripe checkout), billing starts from a cold cache, so billing.isLoading is briefly true. During that window offersPlans is false, so the gate falls through and renders SetupChecklist instead — for however long the billing fetch takes — before flipping to ChoosePlan once it resolves. Someone coming back from paying sees the setup checklist flash before the plan screen shows up.

Fix

Split the static eligibility check (self-hosted, e2e, feature flag — none of which depend on billing's network state) from the full offersPlans check used to decide whether to route into the plan step in the first place. Add showPlanStep, which renders ChoosePlan optimistically while billing is still loading, and only falls back to the checklist once billing actually resolves and says the user can't upgrade:

const showPlanStep =
	step === "plan" &&
	Boolean(websiteId) &&
	planStepFlagEligible &&
	(billing.isLoading || (!billing.isError && billing.canUserUpgrade));

ChoosePlan already tolerates billing.isLoading gracefully (it shows "Your setup is saved" instead of the plan name), so this doesn't need any change inside that component.

offersPlans itself is untouched in meaning — still used as-is for the "Continue" button decision after setup.

Note

While tracing this I noticed isDashboardE2E unconditionally disables the plan step for the whole e2e run (it's a single process-wide env flag, not per-test), so the existing e2e suite can't actually reach ChoosePlan regardless of this fix. Didn't try to solve that here — flagging it since the original PR description mentions e2e coverage for "reload on the plan step," which doesn't look reachable under the current gating. No automated test added for this specific fix as a result; verified by tracing the render logic by hand plus tsc --noEmit clean across all 37 packages.

Disclosure: implemented with AI assistance (Claude Code); verified by manually tracing both render paths (fresh reload vs. billing already cached) against the actual component logic before submitting.


Summary by cubic

Stops the onboarding flow from flashing SetupChecklist when resuming at ?step=plan, such as returning from Stripe checkout. Previously ChoosePlan only rendered after billing finished fetching, so a cold billing state briefly fell through to the checklist; now the plan step renders optimistically while billing loads, and only falls back if billing resolves and says the user can't upgrade. offersPlans is unchanged and still drives the "Continue" button behavior.

Note: isDashboardE2E gates the plan step off for the whole e2e run (it's a process-wide env flag, not per-test), so the existing e2e suite can't actually reach ChoosePlan, and no automated test was added for this fix. Verified by hand-tracing the render paths and a clean tsc --noEmit.

Written for commit 2dc24d5. Summary will update on new commits.

View guided diff

izadoesdev and others added 5 commits October 9, 2026 16:45
After setup, owners and admins on cloud pick a plan from one card that
lists each plan's monthly allowances, price and upgrade action, then
open the dashboard or Insights. Checkout returns to the same step.

(cherry picked from commit 8c5517d)
The plan step now also needs the onboarding-plan-step flag, so it can
reach half of new owners first. Billing only reports an error or a
pending check when its data is missing, so a failed plan list or a
background refetch no longer turns Open Insights into Open dashboard.
Returning to the plan step from checkout or a reload no longer repeats
the onboarding started and tracking verified events.

(cherry picked from commit efbd272)
…step

Members without billing rights no longer see plans while billing loads or fails, the card no longer claims Free when billing failed, and going back to setup after checkout records tracking verification again.

(cherry picked from commit 6fa430d)
E2E and self-host builds skip the Autumn provider, so the plan step crashed there. It now needs a live billing build and the onboarding-plan-step flag, and the e2e specs return to main's flow. The pricing table drops props only onboarding used, and the plan step file is named after its component.
@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

@FindMalek is attempting to deploy a commit to the Databuddy OSS Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
vercel Bot temporarily deployed to Preview – documentation October 9, 2026 17:35 Inactive
@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
documentation Skipped Skipped Oct 9, 2026 5:35pm UTC

@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. 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: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 31afe566-bd36-482b-8d05-b3a79a08a451

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Changes onboarding flow logic for billing state handling.

The PR appears safe to merge, with a remaining checklist flash when the plan-step flag is not cached.

Findings

  1. P2 Checklist still flashes on reload ▶

Summary

Separates plan-step rendering from the billing checks used by the setup Continue button.

  • Returning to onboarding keeps the plan screen open while billing loads.

Reviews (1) · Last reviewed commit: "fix(dashboard): keep the onboarding plan..." · Reviewed by Greptile

const showPlanStep =
step === "plan" &&
Boolean(websiteId) &&
planStepFlagEligible &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Checklist still flashes on reload

On a reload with an expired or missing flag cache, isOn("onboarding-plan-step") returns false until the flag loads. That makes showPlanStep false even while billing loads, so the page shows SetupChecklist before switching to ChoosePlan. This leaves the reload fix incomplete. Keep a loading view for a resumed plan step until the flag resolves, and fall back only when it is confirmed off.

@izadoesdev
izadoesdev force-pushed the izadoesdev/onboarding-plan-step-release branch 2 times, most recently from 4950c0c to 09495e3 Compare October 17, 2026 13:23
@izadoesdev
izadoesdev deleted the branch databuddy-analytics:izadoesdev/onboarding-plan-step-release October 17, 2026 13:29
@izadoesdev izadoesdev closed this Oct 17, 2026

This branch was previously deployed

1 inactive deployment
Preview – documentation — 2dc24d52 Deployed Oct 9, 2026 by vercel[bot]
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.

2 participants