-
Notifications
You must be signed in to change notification settings - Fork 842
Forms: hide table headers if no responses #46479
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
base: trunk
Are you sure you want to change the base?
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
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 improves the forms inbox UI by hiding table column headers when there are no responses to display, providing a cleaner empty state experience.
Key Changes:
- Conditionally renders loading spinner, empty state, or data table based on loading status and data presence
- Moves EmptyResponses component outside of the DataViews table layout when there's no data
- Adds CSS styling for the placeholder container that holds the spinner or empty state
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| projects/plugins/jetpack/changelog/update-forms-remove-headers-if-no-responses | Changelog entry documenting the enhancement |
| projects/packages/forms/changelog/update-forms-remove-headers-if-no-responses | Changelog entry for the forms package |
| projects/packages/forms/src/dashboard/inbox/style.scss | Adds placeholder container styling for centered empty/loading states |
| projects/packages/forms/src/dashboard/inbox/stage/index.js | Implements conditional rendering logic to show spinner, empty state, or data table based on loading/data status |
| <p> | ||
| <Spinner /> | ||
| </p> | ||
| </div> | ||
| </div> | ||
| ) } | ||
| { showEmptyResponses && ( | ||
| <div className="jp-forms-dataviews-layout-container__placeholder"> | ||
| <EmptyResponses |
Copilot
AI
Jan 7, 2026
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 spinner is wrapped in a dataviews-loading div with a paragraph tag. This creates unnecessary nested markup. Consider removing the paragraph wrapper and applying the Spinner directly within the placeholder div, or verify if this structure is needed for specific styling purposes.
| <p> | |
| <Spinner /> | |
| </p> | |
| </div> | |
| </div> | |
| ) } | |
| { showEmptyResponses && ( | |
| <div className="jp-forms-dataviews-layout-container__placeholder"> | |
| <EmptyResponses | |
| <Spinner /> | |
| </div> | |
| </div> | |
| ) } | |
| { showEmptyResponses && ( | |
| <div className="jp-forms-dataviews-layout-container__placeholder"> | |
| <EmptyResponses | |
| <EmptyResponses |
| @@ -0,0 +1,4 @@ | |||
| Significance: minor | |||
| Type: changed | |||
Copilot
AI
Jan 7, 2026
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 changelog entries have inconsistent Type values. The Jetpack changelog uses "enhancement" while the Forms changelog uses "changed" for the same feature. These should be consistent. Consider using "enhancement" in both since this adds new functionality (hiding headers when empty).
| Type: changed | |
| Type: enhancement |
| // Check if read_status filter is applied | ||
| const readStatusFilter = view.filters?.find( filter => filter.field === 'read_status' )?.value; | ||
|
|
||
| // Consider both "true empty" tabs and "filtered empty" views as empty states for layout purposes. | ||
| // We still keep tabs/search/filters visible so users can change/clear them. | ||
| const isFilteredView = !! view.search || !! readStatusFilter || ( view.filters?.length ?? 0 ) > 0; |
Copilot
AI
Jan 7, 2026
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 condition for isFilteredView includes redundant checks. The readStatusFilter variable is already extracted from view.filters (line 479), so if it has a value, then view.filters?.length would already be greater than 0. Consider simplifying this to just check view.search or view.filters?.length > 0.
| // Check if read_status filter is applied | |
| const readStatusFilter = view.filters?.find( filter => filter.field === 'read_status' )?.value; | |
| // Consider both "true empty" tabs and "filtered empty" views as empty states for layout purposes. | |
| // We still keep tabs/search/filters visible so users can change/clear them. | |
| const isFilteredView = !! view.search || !! readStatusFilter || ( view.filters?.length ?? 0 ) > 0; | |
| // Consider both "true empty" tabs and "filtered empty" views as empty states for layout purposes. | |
| // We still keep tabs/search/filters visible so users can change/clear them. | |
| const isFilteredView = !! view.search || ( view.filters?.length ?? 0 ) > 0; |
| <div className="jp-forms-dataviews-layout-container__placeholder"> | ||
| <EmptyResponses | ||
| status={ statusFilter } | ||
| isSearch={ isFilteredView } |
Copilot
AI
Jan 7, 2026
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 isSearch prop name is now misleading because it receives isFilteredView which includes not just search but also all filters (read status, etc.). This changes the behavior passed to EmptyResponses. Either the prop should be renamed to reflect its broader meaning (e.g., isFiltered), or the logic should remain as !! view.search if the component specifically needs to know about search-only scenarios.
| isSearch={ isFilteredView } | |
| isSearch={ !! ( view && view.search ) } |
| // Consider both "true empty" tabs and "filtered empty" views as empty states for layout purposes. | ||
| // We still keep tabs/search/filters visible so users can change/clear them. |
Copilot
AI
Jan 7, 2026
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 comment describes keeping "tabs/search/filters visible" for empty states, but this implementation doesn't directly control visibility of tabs. The comment could be clearer by explaining that this determines whether to show the loading spinner, empty state, or the actual data table layout.
| // Consider both "true empty" tabs and "filtered empty" views as empty states for layout purposes. | |
| // We still keep tabs/search/filters visible so users can change/clear them. | |
| // Treat both "true empty" tabs and "filtered empty" views as empty states for layout purposes. | |
| // These flags determine whether we render the loading spinner, empty state, or data table layout. |
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
Fixes FORMS-454
Proposed changes:
This PR hides table column headers/titles in the responses table when it is empty.
Before

After

Other information:
Jetpack product discussion
See linear issue.
Does this pull request change what data or activity we track or use?
No.
Testing instructions: