Skip to content

Conversation

@edanzer
Copy link
Contributor

@edanzer edanzer commented Jan 7, 2026

Fixes FORMS-454

Proposed changes:

This PR hides table column headers/titles in the responses table when it is empty.

  • If responses are loading: we replace Layout (table) with a spinner
  • If responses are empty: we load EmptyResponses component in place of Layout (table) rather than inside it
  • If there are responses: we load Layout (table) like usual

Before
form-responses-empty-before

After
form-responses-empty-after

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

See linear issue.

Does this pull request change what data or activity we track or use?

No.

Testing instructions:

  • Go to Jetpack > Forms
  • Ensure either inbox or spam or trash tab is empty and go to it
  • Confirm we still show the EmptyResponses component/notice, but without table headers
  • Navigate around between empty and non-empty response tabs and confirm everything loads smoothly and nicely when there are responses.

@edanzer edanzer requested a review from a team January 7, 2026 16:33
@edanzer edanzer self-assigned this Jan 7, 2026
Copilot AI review requested due to automatic review settings January 7, 2026 16:33
@edanzer edanzer added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review This PR is ready for review. [Pri] Normal [Package] Forms labels Jan 7, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the update/forms-remove-headers-if-no-responses branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/forms-remove-headers-if-no-responses

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Feature] Contact Form [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Jan 7, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

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.

@edanzer edanzer requested a review from ilonagl January 7, 2026 16:35
Copy link
Contributor

Copilot AI left a 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

Comment on lines +557 to +565
<p>
<Spinner />
</p>
</div>
</div>
) }
{ showEmptyResponses && (
<div className="jp-forms-dataviews-layout-container__placeholder">
<EmptyResponses
Copy link

Copilot AI Jan 7, 2026

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.

Suggested change
<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

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,4 @@
Significance: minor
Type: changed
Copy link

Copilot AI Jan 7, 2026

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).

Suggested change
Type: changed
Type: enhancement

Copilot uses AI. Check for mistakes.
Comment on lines 478 to +483
// 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;
Copy link

Copilot AI Jan 7, 2026

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.

Suggested change
// 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;

Copilot uses AI. Check for mistakes.
<div className="jp-forms-dataviews-layout-container__placeholder">
<EmptyResponses
status={ statusFilter }
isSearch={ isFilteredView }
Copy link

Copilot AI Jan 7, 2026

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.

Suggested change
isSearch={ isFilteredView }
isSearch={ !! ( view && view.search ) }

Copilot uses AI. Check for mistakes.
Comment on lines +481 to +482
// 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.
Copy link

Copilot AI Jan 7, 2026

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.

Suggested change
// 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.

Copilot uses AI. Check for mistakes.
@jp-launch-control
Copy link

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/dashboard/inbox/stage/index.js 0/153 (0.00%) 0.00% 5 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Contact Form [Package] Forms [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal [Status] Needs Review This PR is ready for review. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants