Skip to content

Small onboarding fixes#1489

Merged
Developing-Gamer merged 5 commits into
devfrom
small-onboarding-fixes
May 27, 2026
Merged

Small onboarding fixes#1489
Developing-Gamer merged 5 commits into
devfrom
small-onboarding-fixes

Conversation

@Developing-Gamer
Copy link
Copy Markdown
Collaborator

@Developing-Gamer Developing-Gamer commented May 26, 2026


Summary by cubic

Improves onboarding and analytics visuals. Adds clear Stripe setup actions (Connect or Do Later) with safe redirects and precise loading/disabled states, and fixes a stuck dashboard reload after linking an existing project.

  • New Features

    • Payments onboarding: separate Connect/Do Later actions with per-button loading and mutual disabling.
    • US-only: “Do Later” creates a deferred Stripe account before finishing onboarding.
    • Secure redirect: enforce HTTPS on Connect and navigate via window.location.href.
    • Refresh Stripe account cache after setupPayments() to avoid stale data on return.
    • Analytics: smoother pie hover transitions, fading center label, optional showDateRange; dashboard donut hides date range and adjusts radii; revenue hover chart uses split bars for rounded tops and an avg line.
    • Tests cover deferred/unsupported payments setup and button loading isolation.
  • Bug Fixes

    • After linking an existing config, use a full page navigation to the project to prevent the dashboard from getting stuck on initial load.

Written for commit c80034a. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • New Features

    • Option to defer payments setup during project onboarding; connect/defer actions show targeted loading states.
  • Improvements

    • Linking existing projects now performs full navigation when applicable.
    • Charts: refined donut/pie sizing, smoother center fade animation, optional date-range display, and improved color/stack rendering.
    • Payments setup now refreshes account info after setup.
  • Tests

    • Added tests covering payments deferral, connect flows, and UI/loading behavior.

Review Change Stack

@Developing-Gamer Developing-Gamer self-assigned this May 26, 2026
Copilot AI review requested due to automatic review settings May 26, 2026 19:35
@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

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

Project Deployment Actions Updated (UTC)
stack-auth-hosted-components Ready Ready Preview, Comment May 26, 2026 9:26pm
stack-auth-mcp Ready Ready Preview, Comment May 26, 2026 9:26pm
stack-auth-skills Ready Ready Preview, Comment May 26, 2026 9:26pm
stack-backend Ready Ready Preview, Comment May 26, 2026 9:26pm
stack-dashboard Ready Ready Preview, Comment May 26, 2026 9:26pm
stack-demo Ready Ready Preview, Comment May 26, 2026 9:26pm
stack-docs Ready Ready Preview, Comment May 26, 2026 9:26pm
stack-preview-backend Ready Ready Preview, Comment May 26, 2026 9:26pm
stack-preview-dashboard Ready Ready Preview, Comment May 26, 2026 9:26pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

📝 Walkthrough

Walkthrough

This PR adds deferred payments setup to the onboarding wizard with action-state tracking, two setup callbacks, conditional full-page navigation for link-existing mode, test coverage updates, and Stripe cache refreshes; it also enhances analytics pie chart animations, exposes a showDateRange prop, and reworks revenue hover bars with split stacked segments.

Changes

Deferred Payments Setup in Onboarding

Layer / File(s) Summary
Payments action state and setup callbacks
apps/.../project-onboarding-wizard.tsx
paymentsSetupAction state tracks the active setup action. deferPaymentsSetup and connectPaymentsSetup run setupPayments(), validate/handle redirects, persist onboarding state, navigate or advance to welcome, and clear action state.
Payments button UI and test coverage
apps/.../project-onboarding-wizard.tsx, apps/.../project-onboarding-wizard.test.tsx
"Do Later" and "Connect" use paymentsSetupAction for loading/disabled behavior and call the new callbacks. Test mock updated to accept loading and new tests cover deferred setup (US vs unsupported countries) and loading/disabled UI behavior.
Backend Stripe account cache refresh
packages/template/.../admin-app-impl.ts
setupPayments() saves the interface result, refreshes _stripeAccountInfoCache, and returns the saved result.
Conditional navigation for link-existing mode
apps/.../content.tsx
onComplete now computes the project URL and uses window.location.href for mode === "link-existing", otherwise uses router.push.

Analytics Chart Enhancements

Layer / File(s) Summary
Pie chart animation and display improvements
packages/dashboard-ui-components/src/components/analytics-chart/analytics-chart-pie.tsx, packages/dashboard-ui-components/src/components/analytics-chart/types.ts
Adds useEffect/useState for delayed center-display fade transitions, segmentTransitionStyle for segment opacity animations, conditions footer on `(showDateRange
Revenue hover chart visualization rework
apps/.../projects/[projectId]/(overview)/line-chart.tsx
Donut pieSize updated and showDateRange: false set; revenue data split into new_cents_square and new_cents_rounded and rendered as two stacked bars to control rounded corners; tooltip marker colors switched to CSS variables.

Sequence Diagram

sequenceDiagram
  participant User
  participant OnboardingWizard
  participant AdminApp
  participant StripeProvider
  participant Browser

  User->>OnboardingWizard: Click "Do Later" in payments_setup
  OnboardingWizard->>OnboardingWizard: Set paymentsSetupAction="defer"
  OnboardingWizard->>AdminApp: setupPayments() (US only)
  AdminApp->>StripeProvider: Create deferred Stripe account
  StripeProvider-->>AdminApp: Account response
  AdminApp->>AdminApp: Refresh _stripeAccountInfoCache
  AdminApp-->>OnboardingWizard: Return result
  OnboardingWizard->>OnboardingWizard: Persist onboarding state
  OnboardingWizard->>OnboardingWizard: Transition to "welcome" step
  OnboardingWizard->>OnboardingWizard: Clear paymentsSetupAction

  User->>OnboardingWizard: Click "Connect" in payments_setup
  OnboardingWizard->>OnboardingWizard: Set paymentsSetupAction="connect"
  OnboardingWizard->>AdminApp: setupPayments()
  AdminApp->>StripeProvider: Create Stripe account
  StripeProvider-->>AdminApp: Account with redirect URL
  AdminApp->>AdminApp: Refresh _stripeAccountInfoCache
  AdminApp-->>OnboardingWizard: Return result with redirect URL
  OnboardingWizard->>OnboardingWizard: Validate HTTPS redirect URL
  OnboardingWizard->>Browser: window.location.href to provider
  Browser->>StripeProvider: Navigate to payments flow
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • N2D4
  • BilalG1

🐰 A wizard's deferred dance, charts animate with grace,
Split bars bloom like spring flowers, Stripe flows through the space,
Link-existing takes the highway, payments rest in place,
Actions tracked and buttons lighting, onboarding finds its pace,
Rabbits cheer the merge — hop on, ship with gentle pace! 🌷

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and generic; it does not convey specific information about the actual changes (payments onboarding, Stripe setup flows, analytics improvements, dashboard reload fix). Consider a more descriptive title that highlights a key change, such as 'Improve payments onboarding with deferred/connect flows and fix dashboard navigation'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description is comprehensive and well-structured, covering new features, bug fixes, and implementation details despite the minimal template requirements.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch small-onboarding-fixes

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 and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes a set of small onboarding and dashboard UI refinements, primarily around payments onboarding behavior and analytics chart presentation.

Changes:

  • Refresh Stripe account info cache after setupPayments() and improve payments onboarding actions (defer/connect) with clearer loading/disabled behavior plus new tests.
  • Add a showDateRange option to the analytics pie chart and improve hover/center-display transitions.
  • Tweak dashboard overview charts (donut sizing and revenue bar rounding) and adjust post-onboarding navigation behavior for “link-existing” mode.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/template/src/lib/stack-app/apps/implementations/admin-app-impl.ts Refreshes Stripe account info cache after payments setup to keep client state in sync.
packages/dashboard-ui-components/src/components/analytics-chart/types.ts Extends pie chart config with showDateRange.
packages/dashboard-ui-components/src/components/analytics-chart/analytics-chart-pie.tsx Implements showDateRange and smooths pie hover/center label transitions.
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/line-chart.tsx Updates donut sizing, refines revenue tooltip marker styling, and splits revenue bars to control rounding in stacked bars.
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx Adds explicit payments action state for “Do Later” vs “Connect” flows (including deferred US Stripe account creation).
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.test.tsx Adds coverage for deferred payments behavior and per-button loading/disable states.
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/content.tsx Uses full page navigation on completion when in “link-existing” mode.
Comments suppressed due to low confidence (1)

apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/line-chart.tsx:2492

  • The tooltip marker for "Revenue" was updated to use the theme color CSS variable, but the "Refunds" marker a few lines below is still hard-coded (hsl(355,...)). This can desync the tooltip from revenueHoverChartConfig (and won’t adapt to dark theme). Use the same var(--color-refund_cents) approach for the refunds marker as well.
            <span className="h-2 w-2 rounded-full ring-2 ring-white/20" style={{ backgroundColor: "var(--color-new_cents)" }} />
            <span className="text-[11px] text-muted-foreground">Revenue</span>
            <span className="ml-auto font-mono text-xs font-semibold tabular-nums text-foreground">
              {formatUsdCompact(row.new_cents)}
            </span>

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 26, 2026

Greptile Summary

This PR makes several small onboarding fixes: it introduces per-button loading states for the payments wizard step so "Do Later" and "Connect" each show their own spinner while disabling the other, forces a full page reload on onComplete in link-existing mode, and refreshes the Stripe account info cache immediately after setupPayments() is called.

  • Payments step UX: paymentsSetupAction state tracks which action is in-flight; DesignButton's loading prop automatically disables the button, and the sibling button is explicitly disabled via saving && paymentsSetupAction !== <action>. Four new tests cover the US-deferred account creation, unsupported-country skipping, and per-button loading isolation.
  • link-existing fix: window.location.href replaces router.push in the link-existing completion path, triggering a hard reload to flush any stale Next.js client state.
  • Chart polish: donut radii increased, showDateRange prop added to AnalyticsChartPie, and the revenue bar is split into two stacked Bars (square-top for refund days, round-top for clean days) to visually distinguish them.

Confidence Score: 4/5

Safe to merge; all logic changes are well-tested and the payments flow handles error paths correctly.

The per-action loading state pattern is correct in practice because DesignButton internally sets disabled = props.disabled || loading, so a stuck paymentsSetupAction won't allow duplicate clicks. However, setPaymentsSetupAction is set before runWithSaving starts, while its finally reset lives inside the callback — if runWithSaving ever threw before entering the callback the action state would leak. The fix is minor but makes the lifecycle symmetric with how saving is managed.

project-onboarding-wizard.tsx — the setPaymentsSetupAction / runWithSaving ordering in both deferPaymentsSetup and connectPaymentsSetup.

Important Files Changed

Filename Overview
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx Refactors payments step buttons to use per-action loading state; extracts deferPaymentsSetup and connectPaymentsSetup into useCallback hooks. State mutation (setPaymentsSetupAction) happens outside runWithSaving but reset happens inside — asymmetry noted but harmless because DesignButton disables itself on loading=true.
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.test.tsx Adds four new tests covering deferred US payments, non-US deferral, and per-button loading indicator isolation. Extends the DesignButton mock to expose data-loading attribute. Tests are accurate and match the implementation logic.
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/content.tsx Switches onComplete to use window.location.href (full reload) for link-existing mode; router.push is kept for other modes. Internal URL constructed via encodeURIComponent is safe. No security concerns.
packages/template/src/lib/stack-app/apps/implementations/admin-app-impl.ts Adds a cache refresh for stripe account info immediately after setupPayments(), ensuring the UI reflects the new account state without requiring a full page reload.
packages/dashboard-ui-components/src/components/analytics-chart/analytics-chart-pie.tsx Adds animated center-text crossfade (fade-out/fade-in) on segment hover, dynamic max-width calculation based on innerRadius, and a showDateRange prop to conditionally hide the date range label. Straightforward UI enhancement.
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/line-chart.tsx Increases donut chart radii, hides date range on compact pies, and splits the revenue bar into two stacked Bars (square-top for refund days, round-top for clean days) for cleaner visual differentiation.
packages/dashboard-ui-components/src/components/analytics-chart/types.ts Adds showDateRange optional boolean to AnalyticsChartPieProps type to support the new conditional rendering.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([User on payments_setup step]) --> B{Click button}
    B -->|Do Later| C[setPaymentsSetupAction 'defer']
    B -->|Connect| D[setPaymentsSetupAction 'connect']

    C --> E[runWithSaving starts\nsaving = true]
    D --> F[runWithSaving starts\nsaving = true]

    E --> G{selectedPaymentsCountry}
    G -->|US| H[setupPayments\ncreates deferred account\ncache refreshed]
    G -->|Other| I[skip setupPayments]
    H --> J[persistOnboardingState]
    I --> J
    J --> K[setStatus 'welcome']
    K --> L[setPaymentsSetupAction null\nsaving = false]

    F --> M[setupPayments\nget redirect URL]
    M --> N{protocol https?}
    N -->|No| O[throw error → alert shown]
    N -->|Yes| P[window.location.href = url\nredirect to Stripe]
    P --> Q[finally: setPaymentsSetupAction null]
    O --> Q

    style H fill:#d4edda
    style P fill:#cce5ff
    style O fill:#f8d7da
Loading
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx:380-393
The `setPaymentsSetupAction("defer")` call sits outside `runWithSaving`, while its matching reset (`setPaymentsSetupAction(null)`) lives inside the callback's `finally` block. If `runWithSaving` itself were to throw before ever entering the callback (an internal invariant break), `paymentsSetupAction` would be stuck at `"defer"` with `saving` back at `false`, leaving the "Do Later" button permanently in a loading state for that session. Moving the initial set inside `runWithSaving` — mirroring how `saving` is managed — makes the lifecycle symmetric and eliminates the leak.

```suggestion
  const deferPaymentsSetup = useCallback(async () => {
    await runWithSaving(async () => {
      setPaymentsSetupAction("defer");
      try {
        if (selectedPaymentsCountry === "US") {
          await props.project.app.setupPayments();
        }
        await persistOnboardingState();
        await setStatus("welcome");
      } finally {
        setPaymentsSetupAction(null);
      }
    });
  }, [persistOnboardingState, props.project.app, runWithSaving, selectedPaymentsCountry, setStatus]);
```

### Issue 2 of 2
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx:395-409
Same asymmetry for `connectPaymentsSetup`: `setPaymentsSetupAction("connect")` is set before entering `runWithSaving`, but cleared inside it. Apply the same fix for consistency.

```suggestion
  const connectPaymentsSetup = useCallback(async () => {
    await runWithSaving(async () => {
      setPaymentsSetupAction("connect");
      try {
        const setup = await props.project.app.setupPayments();
        const redirectUrl = new URL(setup.url);
        if (redirectUrl.protocol !== "https:") {
          throw new Error("Payments setup redirect URL must use HTTPS.");
        }
        window.location.href = redirectUrl.toString();
      } finally {
        setPaymentsSetupAction(null);
      }
    });
  }, [props.project.app, runWithSaving]);
```

Reviews (1): Last reviewed commit: "made the chart consistent with others" | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx (1)

929-943: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Disable both payment actions while a payment action is in-flight.

Line 929 and Line 940 keep the currently-running action button enabled. That allows repeated clicks and duplicate setupPayments() calls.

Proposed fix
-            disabled={saving && paymentsSetupAction !== "defer"}
+            disabled={saving || paymentsSetupAction != null}
             loading={paymentsSetupAction === "defer"}
             onClick={() => runAsynchronouslyWithAlert(deferPaymentsSetup)}
@@
-            disabled={saving && paymentsSetupAction !== "connect"}
+            disabled={saving || paymentsSetupAction != null}
             loading={paymentsSetupAction === "connect"}
             onClick={() => runAsynchronouslyWithAlert(connectPaymentsSetup)}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/dashboard/src/app/`(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx
around lines 929 - 943, Both payment buttons (the DesignButton that triggers
deferPaymentsSetup and the one that triggers connectPaymentsSetup) are still
enabled for the currently-running action, allowing duplicate submits; change
their disabled prop to disable whenever a payment action is in flight (use the
existing saving flag or paymentsSetupAction !== null) and keep loading tied to
the specific action. Concretely, update the primary DesignButton (onClick ->
runAsynchronouslyWithAlert(deferPaymentsSetup)) and the secondary DesignButton
(onClick -> runAsynchronouslyWithAlert(connectPaymentsSetup)) to use
disabled={saving} (or disabled={paymentsSetupAction !== null}) and keep
loading={paymentsSetupAction === "defer"} / loading={paymentsSetupAction ===
"connect"} respectively so no button is clickable while a payment setup is
running.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/dashboard-ui-components/src/components/analytics-chart/analytics-chart-pie.tsx`:
- Around line 170-172: The truthy checks for hoverKey and centerDisplayKey
incorrectly treat an empty string as absent; update the conditions so activeRow
(where hoverKey is used), activeIdx, and centerDisplayRow use explicit
null/undefined checks (e.g., hoverKey !== null && hoverKey !== undefined or
hoverKey != null) before calling legendRows.find(r => r.key === hoverKey) or
r.key === centerDisplayKey so that empty-string segment keys ("") are matched
correctly; locate the usages in activeRow, activeIdx and centerDisplayRow and
replace the ternary/truthy guards with explicit null checks.

---

Outside diff comments:
In
`@apps/dashboard/src/app/`(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx:
- Around line 929-943: Both payment buttons (the DesignButton that triggers
deferPaymentsSetup and the one that triggers connectPaymentsSetup) are still
enabled for the currently-running action, allowing duplicate submits; change
their disabled prop to disable whenever a payment action is in flight (use the
existing saving flag or paymentsSetupAction !== null) and keep loading tied to
the specific action. Concretely, update the primary DesignButton (onClick ->
runAsynchronouslyWithAlert(deferPaymentsSetup)) and the secondary DesignButton
(onClick -> runAsynchronouslyWithAlert(connectPaymentsSetup)) to use
disabled={saving} (or disabled={paymentsSetupAction !== null}) and keep
loading={paymentsSetupAction === "defer"} / loading={paymentsSetupAction ===
"connect"} respectively so no button is clickable while a payment setup is
running.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c2f1486-4576-476c-afd6-e6fbc192edcc

📥 Commits

Reviewing files that changed from the base of the PR and between c276a82 and 864b0db.

📒 Files selected for processing (7)
  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/content.tsx
  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.test.tsx
  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/line-chart.tsx
  • packages/dashboard-ui-components/src/components/analytics-chart/analytics-chart-pie.tsx
  • packages/dashboard-ui-components/src/components/analytics-chart/types.ts
  • packages/template/src/lib/stack-app/apps/implementations/admin-app-impl.ts

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

No issues found across 7 files

Tip: cubic could auto-approve low-risk PRs like this, if it thinks it's safe to merge. Learn more

Re-trigger cubic

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx (1)

395-409: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Persist the payments step state before redirecting.

selectedPaymentsCountry is part of ProjectOnboardingState, but this path skips persistOnboardingState(). If a user switches from "OTHER" to "US" here and then comes back from Stripe without finishing, the wizard rehydrates from stale state and hides the Connect action again.

💡 Suggested fix
   const connectPaymentsSetup = useCallback(async () => {
     await runWithSaving(async () => {
       setPaymentsSetupAction("connect");
       try {
+        await persistOnboardingState();
         const setup = await props.project.app.setupPayments();
         const redirectUrl = new URL(setup.url);
         if (redirectUrl.protocol !== "https:") {
           throw new Error("Payments setup redirect URL must use HTTPS.");
         }
         window.location.href = redirectUrl.toString();
       } finally {
         setPaymentsSetupAction(null);
       }
     });
-  }, [props.project.app, runWithSaving]);
+  }, [persistOnboardingState, props.project.app, runWithSaving]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/dashboard/src/app/`(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx
around lines 395 - 409, In connectPaymentsSetup, persist the updated onboarding
state (including selectedPaymentsCountry) before navigating away: after
setPaymentsSetupAction("connect") and after awaiting
props.project.app.setupPayments(), call persistOnboardingState() (ensuring it
uses the current ProjectOnboardingState) then validate the redirect URL and set
window.location.href; ensure setPaymentsSetupAction(null) still runs in the
finally block. This change should be made inside the connectPaymentsSetup
function and references persistOnboardingState, setPaymentsSetupAction,
selectedPaymentsCountry, and props.project.app.setupPayments.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@apps/dashboard/src/app/`(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx:
- Around line 395-409: In connectPaymentsSetup, persist the updated onboarding
state (including selectedPaymentsCountry) before navigating away: after
setPaymentsSetupAction("connect") and after awaiting
props.project.app.setupPayments(), call persistOnboardingState() (ensuring it
uses the current ProjectOnboardingState) then validate the redirect URL and set
window.location.href; ensure setPaymentsSetupAction(null) still runs in the
finally block. This change should be made inside the connectPaymentsSetup
function and references persistOnboardingState, setPaymentsSetupAction,
selectedPaymentsCountry, and props.project.app.setupPayments.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fd05a5c6-df3e-4108-b5f1-fac00a4d8303

📥 Commits

Reviewing files that changed from the base of the PR and between 864b0db and c80034a.

📒 Files selected for processing (4)
  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.test.tsx
  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/new-project/page-client-parts/project-onboarding-wizard.tsx
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/line-chart.tsx
  • packages/dashboard-ui-components/src/components/analytics-chart/analytics-chart-pie.tsx

@Developing-Gamer Developing-Gamer merged commit a27e4d9 into dev May 27, 2026
39 checks passed
@Developing-Gamer Developing-Gamer deleted the small-onboarding-fixes branch May 27, 2026 00:45
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.

3 participants