-
Notifications
You must be signed in to change notification settings - Fork 909
fix(Table): ensure colspan
calc for loading
and empty
states
#4826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a colspan
calculation issue in the Table component for loading and empty states when dealing with grouped columns. The fix ensures that cells properly span across all visible columns instead of only top-level column groups.
- Updates
colspan
calculation to usetableApi.getAllLeafColumns().length
instead ofcolumns?.length
- Affects both loading state row and empty state row
- Ensures proper cell alignment when columns are grouped
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
<td :colspan="tableApi.getAllLeafColumns().length" :class="ui.loading({ class: props.ui?.loading })"> | ||
<slot name="loading" /> | ||
</td> | ||
</tr> | ||
|
||
<tr v-else> | ||
<td :colspan="columns?.length" :class="ui.empty({ class: props.ui?.empty })"> | ||
<td :colspan="tableApi.getAllLeafColumns().length" :class="ui.empty({ class: props.ui?.empty })"> |
Copilot
AI
Aug 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tableApi.getAllLeafColumns().length
call could potentially throw an error if tableApi
is undefined or null. Consider adding a null check or providing a fallback value to prevent runtime errors.
Copilot uses AI. Check for mistakes.
<td :colspan="tableApi.getAllLeafColumns().length" :class="ui.loading({ class: props.ui?.loading })"> | ||
<slot name="loading" /> | ||
</td> | ||
</tr> | ||
|
||
<tr v-else> | ||
<td :colspan="columns?.length" :class="ui.empty({ class: props.ui?.empty })"> | ||
<td :colspan="tableApi.getAllLeafColumns().length" :class="ui.empty({ class: props.ui?.empty })"> |
Copilot
AI
Aug 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tableApi.getAllLeafColumns().length
call could potentially throw an error if tableApi
is undefined or null. Consider adding a null check or providing a fallback value to prevent runtime errors.
Copilot uses AI. Check for mistakes.
commit: |
Do you have a reproduction of the issue? I think this is correct but I'm wondering if we should use |
colspan
issue with grouped columnscolspan
calc for loading
and empty
states
Hi @benjamincanac,
I've set up the reproduction to demonstrate this exact issue:
That's a really sharp observation, and I'm glad you brought it up. I actually had the exact same thought at first! My initial impulse was to use Hereβs what the docs say :
For the You're right that Using Hope this clarifies my reasoning. Let me know what you think! |
@fabianmerino Thanks a lot for the explanation π |
π Linked issue
β Type of change
π Description
This PR resolves an issue in the
Table
component where thecolspan
calculation was incorrect for grouped columns duringloading
andempty
states. The fix ensures proper alignment and behavior of cells spanning multiple columns in these scenarios.π Checklist