Skip to content

[Fix]: Handle undefined report.availableIn and improve plan display in ReportChartUpsell (#39451) - #39648

Merged
awaseem merged 6 commits into
supabase:masterfrom
Adityakk9031:Fixes-#39451
Nov 7, 2025
Merged

awaseem merged 6 commits into
supabase:masterfrom
Adityakk9031:Fixes-#39451

Conversation

@Adityakk9031

Copy link
Copy Markdown
Contributor

Related Issue

Fixes: #39451 – Results from SQL query inputs or anything in logs is not showing results properly

🐛 Issue Description

When rendering charts or upsell cards (like ReportChartUpsell and ReportChartV2), the app threw runtime errors such as:

TypeError: Cannot read properties of undefined (reading 'includes')

or failed to render the plan label properly.
This caused the results/log output sections to break visually — leading to blank results and layout shifts when viewing query/log reports.

Root cause:

report.availableIn was sometimes undefined or not an array.

Direct access like report.availableIn.includes(...) or report.availableIn[0] caused crashes in these components, which indirectly prevented results/logs from displaying.

🛠 What Was Changed

File Updated: components/interfaces/Reports/ReportChartUpsell.tsx

Replaced:

{!!report.availableIn?.length ? report.availableIn[0] : 'Pro'}

with safer logic:

{Array.isArray(report.availableIn) && report.availableIn.length > 0
? report.availableIn[0]
: 'Pro'}

Added optional chaining and array validation to prevent runtime crashes.

Ensured availableIn defaults to 'Pro' when undefined or empty.

Improved UI stability by preventing rendering interruptions in the charts/logs.

💡 Why This Fix Works

By safely checking whether report.availableIn is a valid array before accessing it, we:

Prevent undefined property access errors.

Ensure fallback text ('Pro') always displays correctly.

Restore consistent rendering of SQL query and log results.

🧪 Testing

Steps to Reproduce (before fix):

Go to any dashboard or report screen with limited plan data.

Observe that the “available from plan” text fails to render or the chart disappears.

Console shows TypeError: Cannot read properties of undefined (reading 'includes').

After fix:

The chart loads correctly.

The upsell card displays “Available from Pro plan and above.”

No runtime errors in console.

@Adityakk9031
Adityakk9031 requested a review from a team as a code owner October 19, 2025 09:34
@vercel

vercel Bot commented Oct 19, 2025

Copy link
Copy Markdown

@Adityakk9031 is attempting to deploy a commit to the Supabase Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for contributing to Supabase! ❤️ Our team will review your PR.

A few tips for a smoother review process:

  • If you have a local version of the repo, run pnpm run format to make sure formatting checks pass.
  • Once we've reviewed your PR, please don't trivially merge master (don't click Update branch if there are no merge conflicts to be fixed). This invalidates any pre-merge checks we've run.

@vercel

vercel Bot commented Oct 19, 2025 •

Copy link
Copy Markdown

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

Project Deployment Preview Comments Updated (UTC)
cms Ready Ready Preview Comment Nov 7, 2025 3:56pm
design-system Ready Ready Preview Comment Nov 7, 2025 3:56pm
docs Ready Ready Preview Comment Nov 7, 2025 3:56pm
studio-self-hosted Ready Ready Preview Comment Nov 7, 2025 3:56pm
studio-staging Ready Ready Preview Comment Nov 7, 2025 3:56pm
ui-library Ready Ready Preview Comment Nov 7, 2025 3:56pm
zone-www-dot-com Ready Ready Preview Comment Nov 7, 2025 3:56pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
studio Ignored Ignored Nov 7, 2025 3:56pm

@awaseem

awaseem commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

@Adityakk9031 You seem to have commited a bunch of binaries. If you can remove those then we can take a look at this

@Adityakk9031 Adityakk9031 left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@awaseem please check it and tell me the mistake so that i can fix it and i will remove the binary file today

@awaseem

awaseem commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

You mistakes have been fixed, but it seems all those newly added files are still there. Please remove them, its in the 7.5 dir

@Adityakk9031
Adityakk9031 requested a review from a team as a code owner November 6, 2025 16:30
@Adityakk9031

Copy link
Copy Markdown
Contributor Author

@awaseem please check it now

@awaseem

awaseem commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

Seems good, going to test self hosted and staging

@coveralls

coveralls commented Nov 6, 2025 •

Copy link
Copy Markdown

Coverage Status

coverage: 68.701%. remained the same
when pulling 4713586 on Adityakk9031:Fixes-#39451
into 2fdba90 on supabase:master.

@awaseem

awaseem commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

Oh one last thing @Adityakk9031. you seem to have some formatting issues. Try running pnpm run format in the root of the dir to fix them

@Adityakk9031

Copy link
Copy Markdown
Contributor Author

Oh one last thing @Adityakk9031. you seem to have some formatting issues. Try running pnpm run format in the root of the dir to fix them

done please check it

@Adityakk9031

Copy link
Copy Markdown
Contributor Author

@awaseem please check it need one approval

@awaseem

awaseem commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Hmmm I think this was already fixed by some other member of the team. Scrolling on that view is fine, still going to accept the contribution for the type safety. Thank you.

@awaseem
awaseem removed the request for review from a team November 7, 2025 21:18
@awaseem
awaseem merged commit d628196 into supabase:master Nov 7, 2025
Rodriguespn pushed a commit that referenced this pull request Nov 25, 2025
…n ReportChartUpsell (#39451) (#39648)

* Fixes: #39451

* commit

* d

* yes

* format fix

* Fix import statement in table-row-query test

This branch had an error being deployed

1 failed deployment
Studio E2E Tests — 47135867 Deployed Nov 7, 2025 by Adityakk9031
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.

[Styling Error]: Results from sql query inputs or anything in logs is not showing results properly

3 participants