Repository navigation
[Fix]: Handle undefined report.availableIn and improve plan display in ReportChartUpsell (#39451) - #39648
Conversation
|
@Adityakk9031 is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for contributing to Supabase! ❤️ Our team will review your PR. A few tips for a smoother review process:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@Adityakk9031 You seem to have commited a bunch of binaries. If you can remove those then we can take a look at this |
There was a problem hiding this comment.
@awaseem please check it and tell me the mistake so that i can fix it and i will remove the binary file today
|
You mistakes have been fixed, but it seems all those newly added files are still there. Please remove them, its in the |
6e298e7 to
210cfc2
Compare
00053b9 to
0b6d827
Compare
bb5e891 to
9fdb0d2
Compare
|
@awaseem please check it now |
|
Seems good, going to test self hosted and staging |
|
Oh one last thing @Adityakk9031. you seem to have some formatting issues. Try running |
bfa47f2 to
c3265e5
Compare
done please check it |
|
@awaseem please check it need one approval |
|
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. |
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.