Repository navigation
fix(component-library): treat slot content that renders only comments as empty - #1392
Open
Arnold Stoba (arnoldstoba) wants to merge 4 commits into
Open
Arnold Stoba (arnoldstoba) wants to merge 4 commits into
Arnold Stoba (arnoldstoba) wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Arnold Stoba (arnoldstoba)
force-pushed
the
fix/slot-comment-only-content
branch
from
October 6, 2026 08:44
4b82a7b to
96b9753
Compare
Arnold Stoba (arnoldstoba)
marked this pull request as ready for review
October 6, 2026 08:44
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
hasSlotContenttreats slot content that renders only comments as empty, also insidev-forfragments. It also accepts slots typed withdefineSlots().Why?
Filtering a list with
<template v-for>andv-if, as the Vue docs recommend, renders only comments when every item is hidden.hasSlotContentcounted that as content, so components that render an optional slot's wrapper only when it has content showed an empty wrapper. For example, with the upcomingmt-message, a user message with only an image attachment rendered an empty text bubble:Vue applies the same rule when it decides whether
<slot>shows its fallback content.How?
One recursive check: comments, empty text and fragments whose children are all empty count as empty.
Testing?
slot.spec.tsrenders real templates: a hiddenv-if, av-forwith every item hidden and one with an item shown.Anything Else?
No visible change for existing components:
mt-base-fieldis the only caller today, and every field fills itserrorslot with a singlev-if, so there is no changeset. #1389 and #1399 carry this commit and need a rebase after this is merged.