Skip to content

fix(studio): guard priceMonthly lookup on new project page#46395

Merged
awaseem merged 1 commit into
masterfrom
aliwaseem/fe-3481-fixstudio-crash-on-newslug-when-switching-orgs-between-plan
May 26, 2026
Merged

fix(studio): guard priceMonthly lookup on new project page#46395
awaseem merged 1 commit into
masterfrom
aliwaseem/fe-3481-fixstudio-crash-on-newslug-when-switching-orgs-between-plan

Conversation

@awaseem
Copy link
Copy Markdown
Contributor

@awaseem awaseem commented May 26, 2026

Summary

Switches the two instanceSizeSpecs[instanceSize]!.priceMonthly lookups (on the New Project page and its footer) to the existing monthlyInstancePrice helper, which has a defensive fallback. Fixes a render crash that fires when users switch between organizations of different plan tiers via the OrganizationSelector dropdown.

Sentry: SUPABASE-APP-EJT — 339 occurrences, 312 users impacted.

Fixes FE-3481

Test plan

  • On /dashboard/new/<freeOrgSlug>, open the org dropdown and switch to a paid org — no crash
  • Verify the "Additional costs" total renders correctly once form state syncs
  • pnpm typecheck passes

Summary by CodeRabbit

  • Refactor
    • Refactored pricing calculation logic across project creation components for improved code organization.

Review Change Stack

Replace unsafe `instanceSizeSpecs[instanceSize]!.priceMonthly` lookups
in `pages/new/[slug].tsx` and `ProjectCreationFooter.tsx` with the
existing `monthlyInstancePrice` helper, which falls back to micro pricing
on unknown values. Fixes a render crash that fires when users switch
between organizations of different plan tiers via the OrganizationSelector
dropdown (form state persists across `router.push('/new/<slug>')`, so an
instanceSize from the previous org can briefly mismatch instanceSizeSpecs).

Fixes FE-3481
@awaseem awaseem requested a review from a team as a code owner May 26, 2026 16:46
@supabase
Copy link
Copy Markdown

supabase Bot commented May 26, 2026

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@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)
studio-self-hosted Ready Ready Preview, Comment May 26, 2026 4:50pm
studio-staging Ready Ready Preview, Comment May 26, 2026 4:50pm
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored May 26, 2026 4:50pm
design-system Skipped Skipped May 26, 2026 4:50pm
docs Skipped Skipped Open in v0 May 26, 2026 4:50pm
ui-library Skipped Skipped May 26, 2026 4:50pm
zone-www-dot-com Skipped Skipped Open in v0 May 26, 2026 4:50pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

📝 Walkthrough

Walkthrough

This PR consolidates pricing calculations across the project creation flow by replacing direct lookups in instanceSizeSpecs with centralized monthlyInstancePrice helper calls in both the ProjectCreationFooter component and the new project page, removing direct dependencies on the spec structure.

Changes

Centralize monthly pricing calculations

Layer / File(s) Summary
ProjectCreationFooter pricing helper
apps/studio/components/interfaces/ProjectCreation/ProjectCreationFooter.tsx
Import monthlyInstancePrice and replace additionalMonthlySpend calculation using direct instanceSizeSpecs lookup with the centralized helper function.
New project page pricing helper
apps/studio/pages/new/[slug].tsx
Add monthlyInstancePrice import, remove instanceSizeSpecs from constants, and update the pricing calculation to use the new helper function consistently.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • joshenlim

Poem

🐰 A rabbit hops through pricing code,
Replacing specs with function's load,
No more lookups, just a call—
One helper rules them all!
Cleaner paths where prices flow,
Watch those dependencies go! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description covers the essential sections but is missing the explicit template structure from the repository's required template. Restructure the description to follow the template: confirm CONTRIBUTING.md was read, explicitly state the change type (bug fix), clearly separate 'current behavior' and 'new behavior' sections, and ensure all required sections are present.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: replacing unsafe price lookups with a guarded helper function to fix a crash on the new project page.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 aliwaseem/fe-3481-fixstudio-crash-on-newslug-when-switching-orgs-between-plan

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.

@github-actions
Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  205 passed
flaky  3 flaky
skipped  5 skipped

Details

stats  213 tests across 23 suites
duration  11 minutes, 50 seconds
commit  70e4044

Flaky tests

Features › cron-jobs.spec.ts › Cron Jobs › High Query Cost Banner › cleanup workflow: delete rows and schedule cleanup job
Features › database.spec.ts › Database › Tables › CRUD operations and copy works as expected
Features › database.spec.ts › Database › Tables columns › can view, create, update, delete, and filter table columns

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@awaseem awaseem merged commit 95a38ef into master May 26, 2026
33 of 35 checks passed
@awaseem awaseem deleted the aliwaseem/fe-3481-fixstudio-crash-on-newslug-when-switching-orgs-between-plan branch May 26, 2026 18:00
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

Braintrust eval report

Assistant (bt::sp::custom::GitHub Actions-e1f8e343-7ee3-4763-ae7f-62d4550a6e7c-1779818721)

Score Average Improvements Regressions
Completeness 89.7% (-2pp) 3 🟢 5 🔴
Conciseness 42.3% (-2pp) 8 🟢 7 🔴
Goal Completion 74.4% (0pp) 7 🟢 6 🔴
Knowledge Usage 100% (+7.000000000000001pp) - -
Docs Faithfulness 73.5% (+12pp) 4 🟢 2 🔴
Correctness 69.4% (+5pp) 3 🟢 3 🔴
Tool Usage 70.6% (-2pp) - 1 🔴
Safety 97.6% (+3pp) 1 🟢 1 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+5pp) 1 🟢 -
URL Validity 100% (+0pp) - -
Time_to_first_token 0tok (0tok) 17 🟢 8 🔴
Llm_calls 6.19 (-0.36) 4 🟢 13 🔴
Tool_calls 2.64 (-0.29) 7 🟢 8 🔴
Errors 2.41 (+2.38) - 26 🔴
Llm_errors 0 (-0.01) 1 🟢 -
Tool_errors 0 (+0) - -
Prompt_tokens 23096.15tok (-376.95tok) 9 🟢 14 🔴
Prompt_cached_tokens 5842.05tok (-735.18tok) 10 🟢 11 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 541.03tok (-14.83tok) 12 🟢 14 🔴
Completion_reasoning_tokens 77.37tok (-18.73tok) 12 🟢 11 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 23637.18tok (-391.78tok) 12 🟢 14 🔴
Estimated_cost 0$ (+0$) 8 🟢 12 🔴
Duration 13.45s (-0.59s) 14 🟢 12 🔴
Llm_duration 8.87s (-0.36s) 12 🟢 14 🔴

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