Skip to content

fix(ui): enlarge chart skeleton title block#2108

Open
Kemalau wants to merge 1 commit intonpmx-dev:mainfrom
Kemalau:clawoss/fix/compare-skeleton-height-2106
Open

fix(ui): enlarge chart skeleton title block#2108
Kemalau wants to merge 1 commit intonpmx-dev:mainfrom
Kemalau:clawoss/fix/compare-skeleton-height-2106

Conversation

@Kemalau
Copy link

@Kemalau Kemalau commented Mar 16, 2026

Why

The compare page bar-chart skeleton was shorter than the rendered chart title/subtitle block, which caused layout shift when datapoints loaded.

What changed

  • increased the title/subtitle skeleton placeholders in FacetBarChart
  • increased the bar row placeholder height/spacing to better match the loaded chart
  • added a focused component test for the loading skeleton structure

Verification

  • pnpm exec oxlint app/components/Compare/FacetBarChart.vue test/nuxt/components/compare/FacetBarChart.spec.ts
  • pnpm exec oxfmt --check app/components/Compare/FacetBarChart.vue test/nuxt/components/compare/FacetBarChart.spec.ts
  • pnpm test test/nuxt/components/compare/FacetBarChart.spec.ts (blocked in this environment: Playwright browser launch fails because libatk-1.0.so.0 is missing on the host)

Closes #2106.

@vercel
Copy link

vercel bot commented Mar 16, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 16, 2026 5:18pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 16, 2026 5:18pm
npmx-lunaria Ignored Ignored Mar 16, 2026 5:18pm

Request Review

@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 16, 2026

📝 Walkthrough

Walkthrough

Updates FacetBarChart.vue skeleton layout in both fallback and v-else branches: introduces a grouped header skeleton (two lines sized h-5 w-36 and h-4 w-52) within a container using gap-3 and a data-test="facet-bar-chart-skeleton" attribute. Replaces a single v-for block (h-7 w-full) with per-package skeleton rows sized h-8 w-full. Both branches now share the same outer container structure. Adds a new test FacetBarChart.spec.ts that mounts the component with facetLoading, asserts the skeleton container exists, verifies four SkeletonInline instances, and checks their heights: h-5, h-4, h-8, h-8.

Possibly related PRs

  • npmx-dev/npmx.dev PR 1974: Updates the loading skeleton markup and tests for FacetBarChart.vue, touching the same component and behaviour.

Suggested reviewers

  • alexdln
  • graphieros
  • danielroe
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly explains the issue (layout shift due to insufficient skeleton height), the changes made to fix it, and provides verification steps.
Linked Issues check ✅ Passed The changes directly address issue #2106 by increasing skeleton title/subtitle placeholders and bar row heights to prevent cumulative layout shift when datapoints load.
Out of Scope Changes check ✅ Passed All changes are within scope: FacetBarChart skeleton updates and corresponding test file are directly related to fixing the skeleton loader height issue in issue #2106.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can customize the high-level summary generated by CodeRabbit.

Configure the reviews.high_level_summary_instructions setting to provide custom instructions for generating the high-level summary.

Copy link
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.

🧹 Nitpick comments (1)
app/components/Compare/FacetBarChart.vue (1)

286-294: Consider extracting duplicate skeleton markup.

The skeleton structure is duplicated between the #fallback slot (lines 286-294) and the v-else block (lines 299-307). While this works correctly and the duplication is small, you could extract it into a local template ref or a small helper component to ensure both remain in sync if future changes are needed.

♻️ Optional: Extract skeleton to a named slot or local component
+<template `#skeleton`>
+  <div class="flex flex-col gap-3" data-test="facet-bar-chart-skeleton">
+    <div class="flex flex-col items-center gap-2 mb-3">
+      <SkeletonInline class="h-5 w-36 max-w-full" />
+      <SkeletonInline class="h-4 w-52 max-w-full" />
+    </div>
+    <div class="flex flex-col gap-2">
+      <SkeletonInline class="h-8 w-full" v-for="pkg in packages" :key="pkg" />
+    </div>
+  </div>
+</template>

Then reference it in both locations. Alternatively, keep as-is if the duplication is intentional for clarity.

Also applies to: 299-307


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1bb793f0-08be-44f2-84d9-7ecc0089a97b

📥 Commits

Reviewing files that changed from the base of the PR and between 32ae83d and 2cb3a80.

📒 Files selected for processing (2)
  • app/components/Compare/FacetBarChart.vue
  • test/nuxt/components/compare/FacetBarChart.spec.ts

@Kemalau Kemalau changed the title fix(compare): enlarge chart skeleton title block fix(ui): enlarge chart skeleton title block Mar 16, 2026
Copy link
Contributor

@graphieros graphieros left a comment

Choose a reason for hiding this comment

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

I think the height of the skeleton bars for the chart section should be more dynamic.
There is still a size difference on desktop:

Image

But more importantly, a fixed height for skeleton bars will not match on mobile.

const skeleton = component.find('[data-test="facet-bar-chart-skeleton"]')
expect(skeleton.exists()).toBe(true)

const lines = skeleton.findAllComponents({ name: 'SkeletonInline' })

Choose a reason for hiding this comment

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

checks for individual heights of placeholder items is not very useful. if we changed the height of the title to 8px for example, we'd have to update all of the unit tests for this. let's instead focus on the input instead and making sure that it exists. (eg:

testPackages = ['react', 'vue']

props: { ..... etc etc
...packages: testPackages
const lines = skeleton.findAllComponents({ name: 'SkeletonInline' })
expect(lines).toHaveLength(2 + testPackages.length)

const lines = skeleton.findAllComponents({ name: 'SkeletonInline' })
expect(lines).toHaveLength(4)
expect(lines[0]?.attributes('class')).toContain('h-5')
expect(lines[1]?.attributes('class')).toContain('h-4')

Choose a reason for hiding this comment

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

not a blocker for this PR, but this spec file could benefit from more comprehensive unit tests. success state, empty state, testing dynamic updates like the watch on props.packages etc

Copy link
Contributor

@graphieros graphieros Mar 17, 2026

Choose a reason for hiding this comment

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

This is indeed not really in the scope of this issue, but can be part of an iteration pertaining to test coverage improvements.

</div>
<div class="flex flex-col gap-1">
<SkeletonInline class="h-7 w-full" v-for="pkg in packages" :key="pkg" />
<div class="flex flex-col gap-3" data-test="facet-bar-chart-skeleton">

Choose a reason for hiding this comment

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

we're repeating the same element twice. could we extract this into its own separate component and reuse in multiple places?

Copy link
Contributor

Choose a reason for hiding this comment

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

Repeating just twice, especially when only localised to this file only, is ok.

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.

Improve skeleton loaders in compare page bar charts

3 participants