Skip to content

feat(ChatShimmer): new component#6171

Merged
benjamincanac merged 5 commits intov4from
feat/chat-shimmer
Mar 11, 2026
Merged

feat(ChatShimmer): new component#6171
benjamincanac merged 5 commits intov4from
feat/chat-shimmer

Conversation

@benjamincanac
Copy link
Member

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@github-actions github-actions bot added the v4 #4488 label Mar 10, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

📝 Walkthrough

Walkthrough

A docs-only ChatShimmer component was removed from docs/app and replaced by a new runtime component at src/runtime/components/ChatShimmer.vue with its prop renamed from text to label. Documentation and example pages (ChatReasoning.vue, ChatTool.vue, playgrounds) were updated to use UChatShimmer. A theme module (src/theme/chat-shimmer.ts) and keyframes (src/runtime/keyframes.css) were added, the component was exported via src/runtime/types/index.ts, a test suite was added, and navigation was updated to include chat-shimmer. Minor server API change reduced a tool usage count.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: introducing a new ChatShimmer component as indicated by the file additions, new exports, and test suite.
Description check ✅ Passed The description is related to the changeset as it marks this as a new feature, but lacks detailed explanation of what the ChatShimmer component does or why it was added.
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 docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/chat-shimmer

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
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 (2)
docs/content/docs/2.components/chat-shimmer.md (1)

12-45: Consider documenting the as prop.

The documentation covers label, duration, and spread props well. The as prop (for rendering as different elements) is defined in ChatShimmerProps but not explicitly documented here. Users might find it useful to know they can render the shimmer as a div or other elements.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/content/docs/2.components/chat-shimmer.md` around lines 12 - 45, Add a
short "as" prop section to the ChatShimmer docs explaining that ChatShimmer
supports an as prop (defined on ChatShimmerProps) to render the shimmer as a
different element (e.g., 'div', 'span', or a custom component); show the default
value, a brief example snippet using as: 'div' and as: 'span', and mention that
it forwards standard element props/attributes to the rendered element so
consumers can pass className, id, etc.
test/components/ChatShimmer.spec.ts (1)

12-19: Consider adding test coverage for the as prop.

The ChatShimmerProps interface includes an as prop that allows rendering as different elements/components, but this isn't covered in the test variations.

💡 Optional: Add test for `as` prop
   renderEach(ChatShimmer, [
     // Props
     ['with label', { props }],
     ['with duration', { props: { ...props, duration: 3 } }],
     ['with spread', { props: { ...props, spread: 4 } }],
     ['with class', { props: { ...props, class: 'custom-class' } }],
-    ['with ui', { props: { ...props, ui: { base: 'font-bold' } } }]
+    ['with ui', { props: { ...props, ui: { base: 'font-bold' } } }],
+    ['with as', { props: { ...props, as: 'div' } }]
   ])
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/components/ChatShimmer.spec.ts` around lines 12 - 19, Add a test case
covering the ChatShimmer "as" prop by updating the renderEach block for
ChatShimmer (where renderEach is used to enumerate prop variations) to include a
variation like 'with as' that passes props with as set (e.g., as: 'section' or
as: MyCustomComponent) so the component renders the specified element/component;
locate the renderEach invocation for ChatShimmer in ChatShimmer.spec.ts and add
the new entry to the array alongside the existing 'with label'/'with duration'
cases, ensuring the test supplies a valid value for the as prop from
ChatShimmerProps.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/content/docs/2.components/chat-shimmer.md`:
- Around line 12-45: Add a short "as" prop section to the ChatShimmer docs
explaining that ChatShimmer supports an as prop (defined on ChatShimmerProps) to
render the shimmer as a different element (e.g., 'div', 'span', or a custom
component); show the default value, a brief example snippet using as: 'div' and
as: 'span', and mention that it forwards standard element props/attributes to
the rendered element so consumers can pass className, id, etc.

In `@test/components/ChatShimmer.spec.ts`:
- Around line 12-19: Add a test case covering the ChatShimmer "as" prop by
updating the renderEach block for ChatShimmer (where renderEach is used to
enumerate prop variations) to include a variation like 'with as' that passes
props with as set (e.g., as: 'section' or as: MyCustomComponent) so the
component renders the specified element/component; locate the renderEach
invocation for ChatShimmer in ChatShimmer.spec.ts and add the new entry to the
array alongside the existing 'with label'/'with duration' cases, ensuring the
test supplies a valid value for the as prop from ChatShimmerProps.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b685696e-032c-4d4d-be84-64886165dbba

📥 Commits

Reviewing files that changed from the base of the PR and between f274310 and d7ae769.

⛔ Files ignored due to path filters (2)
  • test/components/__snapshots__/ChatShimmer-vue.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/ChatShimmer.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (9)
  • docs/app/components/chat/ChatReasoning.vue
  • docs/app/components/chat/ChatShimmer.vue
  • docs/app/components/chat/ChatTool.vue
  • docs/content/docs/2.components/chat-shimmer.md
  • src/runtime/components/ChatShimmer.vue
  • src/runtime/types/index.ts
  • src/theme/chat-shimmer.ts
  • src/theme/index.ts
  • test/components/ChatShimmer.spec.ts
💤 Files with no reviewable changes (1)
  • docs/app/components/chat/ChatShimmer.vue

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 10, 2026

npm i https://pkg.pr.new/@nuxt/ui@6171

commit: f71ef53

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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/runtime/components/ChatShimmer.vue (1)

46-50: Consider clarifying the ui computed naming to avoid confusion.

The computed ui (line 50) shadows the prop ui (line 29), which is why the eslint-disable comment exists. While functional, consider renaming the computed to something like uiVariants or uiStyles to improve readability and remove the need for the eslint-disable.

♻️ Optional refactor to improve clarity
 const appConfig = useAppConfig() as ChatShimmer['AppConfig']
 const uiProp = useComponentUI('chatShimmer', props)
 
-// eslint-disable-next-line vue/no-dupe-keys
-const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.chatShimmer || {}) }))
+const uiStyles = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.chatShimmer || {}) }))

Then in the template:

-    :class="ui({ class: [uiProp?.base, props.class] })"
+    :class="uiStyles({ class: [uiProp?.base, props.class] })"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/runtime/components/ChatShimmer.vue` around lines 46 - 50, The computed
property currently named ui shadows the existing prop ui (created by
useComponentUI('chatShimmer', props)), causing the eslint-disable; rename the
computed from ui to a clearer name like uiVariants or uiStyles (update the
computed declaration and any places in the template or script that reference the
computed) so the prop and computed no longer conflict and you can remove the
eslint-disable-next-line vue/no-dupe-keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@playgrounds/nuxt/server/api/chat.post.ts`:
- Line 28: The call to toUIMessageStreamResponse() in the server message
streaming pipeline no longer forwards reasoning parts by default; update the
invocation of toUIMessageStreamResponse() (in the handler that produces the
streamed UI messages) to pass sendReasoning: true so that message.parts contains
reasoning entries for the frontend (the reasoning UI depends on those parts
being present).

---

Nitpick comments:
In `@src/runtime/components/ChatShimmer.vue`:
- Around line 46-50: The computed property currently named ui shadows the
existing prop ui (created by useComponentUI('chatShimmer', props)), causing the
eslint-disable; rename the computed from ui to a clearer name like uiVariants or
uiStyles (update the computed declaration and any places in the template or
script that reference the computed) so the prop and computed no longer conflict
and you can remove the eslint-disable-next-line vue/no-dupe-keys.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dbafd412-9609-4634-9972-055d9d2c6f0a

📥 Commits

Reviewing files that changed from the base of the PR and between d7ae769 and b5b3b47.

⛔ Files ignored due to path filters (4)
  • docs/public/components/dark/chat-shimmer.png is excluded by !**/*.png
  • docs/public/components/light/chat-shimmer.png is excluded by !**/*.png
  • test/components/__snapshots__/ChatShimmer-vue.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/ChatShimmer.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • playgrounds/nuxt/app/composables/useNavigation.ts
  • playgrounds/nuxt/app/pages/components/chat-shimmer.vue
  • playgrounds/nuxt/server/api/chat.post.ts
  • src/runtime/components/ChatShimmer.vue
  • src/runtime/keyframes.css
  • src/theme/chat-shimmer.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/theme/chat-shimmer.ts

@benjamincanac benjamincanac merged commit 8db9c54 into v4 Mar 11, 2026
28 of 30 checks passed
@benjamincanac benjamincanac deleted the feat/chat-shimmer branch March 11, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant