Skip to content

fix: hide chart when dataset is empty#119

Merged
MatteoGabriele merged 3 commits into
MatteoGabriele:mainfrom
graphieros:118-hide-empty-account-chart
May 13, 2026
Merged

fix: hide chart when dataset is empty#119
MatteoGabriele merged 3 commits into
MatteoGabriele:mainfrom
graphieros:118-hide-empty-account-chart

Conversation

@graphieros
Copy link
Copy Markdown
Contributor

@graphieros graphieros commented May 12, 2026

Resolves #118

Displays a chart icon with a message when the dataset is empty

image

The icon is part of the vue-data-ui library.
Other icons available: https://vue-data-ui.graphieros.com/docs#vue-ui-icon

Summary by CodeRabbit

  • Bug Fixes

    • The account events timeline now shows a centered "No activity to display" message when there is no activity, instead of rendering an empty chart.
  • Chores

    • Build configuration updated so additional UI chart and icon components are available at runtime.

Review Change Stack

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 12, 2026

Deploy Preview for agentscan ready!

Name Link
🔨 Latest commit 0e9c1de
🔍 Latest deploy log https://app.netlify.com/projects/agentscan/deploys/6a0387c11cc4780008d93580
😎 Deploy Preview https://deploy-preview-119--agentscan.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5815fc77-e187-402d-bf4f-940f083f4913

📥 Commits

Reviewing files that changed from the base of the PR and between ab04739 and 0e9c1de.

📒 Files selected for processing (1)
  • app/components/Chart/AccountEventsTimeline.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/components/Chart/AccountEventsTimeline.vue

📝 Walkthrough

Walkthrough

AccountEventsTimeline.vue now detects when aggregated series totals are zero and shows a centered “No activity to display” fallback (using VueUiIcon) instead of rendering VueUiXy; nuxt.config.ts updates Vite optimizeDeps to include specific vue-data-ui components.

Changes

Empty State Detection and Fallback UI

Layer / File(s) Summary
Empty state detection and fallback UI
app/components/Chart/AccountEventsTimeline.vue
Imports VueUiIcon, adds isEmpty computed that sums all series values from datasetLine, updates the VueUiXy render condition to require hasEnoughDays && !isEmpty, and adds a centered "No activity to display" fallback block when the dataset is empty.

Vite optimizeDeps update

Layer / File(s) Summary
Vite optimized deps update
nuxt.config.ts
Replace vue-data-ui/vue-ui-scatter in vite.optimizeDeps.include with vue-data-ui/vue-ui-xy, vue-data-ui/vue-ui-heatmap, and vue-data-ui/vue-ui-icon.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • MatteoGabriele

Poem

🐰 I counted the numbers, hopped around the line,
When totals were zero, I made the chart decline.
A tiny icon sits, "No activity to display,"
Now empty timelines show a friendly way.
Hooray — a bunny's hop for a clearer day.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: hide chart when dataset is empty' clearly describes the main change in the PR, matching the implementation of checking for empty datasets and conditionally rendering the chart.
Linked Issues check ✅ Passed The PR addresses issue #118 by verifying whether the dataset is empty before rendering the chart, replacing the previous event-length-only check with an isEmpty flag that sums all numeric values across all series.
Out of Scope Changes check ✅ Passed All changes are in scope: AccountEventsTimeline.vue implements the empty dataset check and empty-state UI, while nuxt.config.ts updates dependencies for the newly used VueUiXy and VueUiIcon components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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.

🧹 Nitpick comments (1)
app/components/Chart/AccountEventsTimeline.vue (1)

199-204: 💤 Low value

Solid implementation of the emptiness check.

The logic correctly sums all series values across the dataset and handles nullable values appropriately. The nullish coalescing operator usage is consistent with how series values are handled elsewhere in the component (e.g., line 210).

Optional: Add explanatory comment

Consider adding a brief comment to document the purpose:

+// Check if dataset has zero total activity across all series
 const isEmpty = computed(
   () =>
     datasetLine.value
       .flatMap((d) => d.series)
       .reduce((a, b) => (a ?? 0) + (b ?? 0), 0) === 0,
 );
🤖 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 `@app/components/Chart/AccountEventsTimeline.vue` around lines 199 - 204, Add a
brief explanatory comment above the isEmpty computed property to document its
purpose: that it flattens datasetLine.value series arrays, null-coalesces series
values, sums them, and returns true when the total is zero; reference the
isEmpty computed, datasetLine, and the inner series to make intent clear for
future readers and to match existing style (similar to other inline comments
around series handling).
🤖 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.

Nitpick comments:
In `@app/components/Chart/AccountEventsTimeline.vue`:
- Around line 199-204: Add a brief explanatory comment above the isEmpty
computed property to document its purpose: that it flattens datasetLine.value
series arrays, null-coalesces series values, sums them, and returns true when
the total is zero; reference the isEmpty computed, datasetLine, and the inner
series to make intent clear for future readers and to match existing style
(similar to other inline comments around series handling).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c8298734-0e72-4218-859c-4be863143c42

📥 Commits

Reviewing files that changed from the base of the PR and between 50853a3 and b392074.

📒 Files selected for processing (1)
  • app/components/Chart/AccountEventsTimeline.vue

</VueUiXy>
<div
v-if="isEmpty"
class="w-full h-64 flex place-items-center justify-center"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I would probably make it less tall: like around 160px or so

>
<div class="flex flex-col items-center gap-4">
<VueUiIcon name="chartSparkline" :stroke="colors.text" />
<p class="text-gh-muted">No recent events</p>
Copy link
Copy Markdown
Owner

@MatteoGabriele MatteoGabriele May 12, 2026

Choose a reason for hiding this comment

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

I like it a lot!
"No recent events" is probably not the right copy, since sometimes there are events, just none we can show. We need something else, like "No activity to display"? What do you think?

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.

Way better indeed!

@graphieros graphieros requested a review from MatteoGabriele May 12, 2026 20:04
Copy link
Copy Markdown
Owner

@MatteoGabriele MatteoGabriele left a comment

Choose a reason for hiding this comment

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

@MatteoGabriele MatteoGabriele merged commit e10ba5a into MatteoGabriele:main May 13, 2026
5 checks passed
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.

Account graphs shows empty

2 participants