Skip to content

Forms: add forms list to dashboard - #46580

Merged
edanzer merged 16 commits into
trunkfrom
add/forms-list-dataviews-table
Jan 16, 2026
Merged

edanzer merged 16 commits into
trunkfrom
add/forms-list-dataviews-table

Conversation

@edanzer

@edanzer edanzer commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

Addresses FORMS-367

Proposed changes:

This PR adds a DataViews-based list of reusable forms to the forms dashboard. It is part of centralized form management. All this work is still be behind a feature flag. The goal is to move toward the Figma designs here: 8TmDfrB54NU4Rzj19Qs9Tg-fi-5374_18492

Specific changes:

  • Adds forms endpoint to retrieve list of forms (based on forms post type)
  • Adds custom hook to frontend for calling the new forms endpoint
  • Adds DataViews table to front end with forms list, along with associated supporting files

Not done - left for follow ups:

  • Add additional Actions to actions dropdown
  • Add DataViews filters
  • Open single form view, including stats and responses based on form

**Before: forms tab has placeholder **
forms-tab

After: forms tab has forms list
basic-forms-list

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

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

Testing instructions:

Add this feature flag to your test site.

add_filter( 'jetpack_block_editor_feature_flags', 'eb_register_feature' );
function eb_register_feature( $flags ) {
    $flags['central-form-management'] = true;
    return $flags;
}

Test new tabs:

  • Go to Jetpack > Forms
  • Confirm Forms tab now has a list of all your jetpack_form posts
  • If needed, you can create a form post at

Test for now regression:

  • Remove feature flag and confirm everything works as before

@edanzer edanzer self-assigned this Jan 13, 2026
@edanzer edanzer added Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] In Progress [Pri] Normal [Package] Forms labels Jan 13, 2026
@github-actions

github-actions Bot commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

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 add/forms-list-dataviews-table branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/forms-list-dataviews-table

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

Copy link
Copy Markdown
Contributor

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 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!

@jp-launch-control

jp-launch-control Bot commented Jan 13, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/contact-form/class-jetpack-form-endpoint.php 28/77 (36.36%) -33.64% 43 💔
projects/packages/forms/src/dashboard/forms/index.tsx 0/43 (0.00%) 0.00% 35 💔
projects/packages/forms/src/dashboard/class-dashboard.php 24/136 (17.65%) -2.87% 19 💔

2 files are newly checked for coverage.

File Coverage
projects/packages/forms/src/dashboard/forms/views.ts 0/24 (0.00%) 💔
projects/packages/forms/src/dashboard/hooks/use-forms-data.ts 0/10 (0.00%) 💔

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.

@edanzer
edanzer force-pushed the add/forms-list-dataviews-table branch from 7e48f17 to 5fc649b Compare January 14, 2026 17:24
@edanzer
edanzer requested review from a team and ilonagl January 14, 2026 19:24
@edanzer
edanzer marked this pull request as ready for review January 14, 2026 19:45
Copilot AI review requested due to automatic review settings January 14, 2026 19:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds a DataViews-based list of reusable forms to the Jetpack Forms dashboard, enabling centralized form management. The feature is gated behind the central-form-management feature flag and introduces a new REST API endpoint for retrieving forms data, along with a React-based UI to display and manage forms.

Changes:

  • Added new REST endpoint /jetpack-forms/v1/forms to fetch paginated forms list
  • Created DataViews-based forms list UI with search functionality
  • Implemented view state management with URL synchronization

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
projects/packages/forms/src/dashboard/class-forms-endpoint.php New REST endpoint for fetching paginated forms list with entry counts
projects/packages/forms/src/dashboard/hooks/use-forms-data.ts Custom React hook to fetch and manage forms data from the API
projects/packages/forms/src/dashboard/forms/views.ts View state management hook with URL synchronization for search
projects/packages/forms/src/dashboard/forms/index.tsx Main forms list component implementing DataViews with actions and fields
projects/packages/forms/src/dashboard/forms/style.scss Styling for forms list filters bar
projects/packages/forms/src/dashboard/inbox/style.scss Adjusted padding to consolidate styling in parent container
projects/packages/forms/src/dashboard/class-dashboard.php Initialized Forms_Endpoint and added conditional preloading
projects/packages/forms/changelog/add-forms-list-dataviews-table Changelog entry documenting the new feature

@edanzer
edanzer force-pushed the add/forms-list-dataviews-table branch from d1f005d to 1d5e6ce Compare January 15, 2026 16:02
Copilot AI review requested due to automatic review settings January 15, 2026 17:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

// Match dashboard behavior: count feedback statuses we display/manage.
$statuses = array( 'publish', 'draft', 'spam', 'trash' );

$args = array_merge( array( Feedback::POST_TYPE ), $form_ids, $statuses );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is kind of hard to read and follow.
Can we do without it? $args just passing in array( Feedback::POST_TYPE , $form_ids, $statuses )
instead to $wpdb->prepare(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree hard to read. But I don't think we can do the change you're suggesting - it would change the data structure from flat to nested arrays. That said, this is not my strong suite, and I'm getting AI help with this. After some back and forth, I had my AI try to summarize the issue. You can let me know if you know better :).


$wpdb->prepare( $query, $args ) does not “expand” arrays to fill multiple placeholders.

So if $args is: array( Feedback::POST_TYPE, $form_ids, $statuses )

then from prepare()’s perspective you supplied 3 replacement values total:

  • a string (Feedback::POST_TYPE)
  • an array ($form_ids)
  • an array ($statuses)

But the SQL has many placeholders:

  • %s for post_type (1)
  • one %d per form id (N)
  • one %s per status (M)

prepare() expects 1 + N + M scalar values (string/int), in order. It can’t match an “array value” to “a list of %d placeholders” — it won’t iterate and substitute each element. Best case you get warnings / wrong SQL; worst case you get a broken query or the placeholders don’t get safely substituted.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation Erick.

I think what you have works well.

One thing that I think would help here is still remobing the $args variable.
and just doing

$wpdb->prepare( 
   "SELECT...', 
   array_merge( array( Feedback::POST_TYPE ), $form_ids, $statuses );

instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enej - I think that's still the same thing and presents the same concerns?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Copilot AI review requested due to automatic review settings January 16, 2026 17:32
@edanzer
edanzer force-pushed the add/forms-list-dataviews-table branch from d6b9ab6 to 2a016dc Compare January 16, 2026 17:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

projects/packages/forms/changelog/add-forms-list-dataviews-table:4

  • The changelog entry should start with a capital letter and not include a package-specific prefix for entries in that same package. It should be "Add reusable forms list to dashboard." per the custom coding guidelines.
Forms: add reusable forms list to dashboard.

@Automattic Automattic deleted a comment from Copilot AI Jan 16, 2026
@Automattic Automattic deleted a comment from Copilot AI Jan 16, 2026
@Automattic Automattic deleted a comment from Copilot AI Jan 16, 2026
@edanzer
edanzer merged commit fed0c29 into trunk Jan 16, 2026
77 of 78 checks passed
@edanzer
edanzer deleted the add/forms-list-dataviews-table branch January 16, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Forms [Package] Forms [Pri] Normal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants