Skip to content

Conversation

enejb
Copy link
Member

@enejb enejb commented Sep 24, 2025

This PR improved the performance of the inital loading of the forms dashboard by making sure that any slow ( things that require .com request don't block the page from loading )

Proposed changes:

  • Add a _fields argument that takes a "sync" value in case we want to return all the values that can be fetched right away.

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

None.

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

No

Testing instructions:

  • Load this PR.
  • Notice that your loading of wp-admin/admin.php?page=jetpack-forms-admin is much faster.
  • Notice that your loading of the block editor is also much faster.

Endpoints for feedback config and integrations now use the '_fields=sync' query to minimize heavy operations during initial load. Conditional logic was added to avoid expensive checks and data fetching for integrations and AI features unless required, improving dashboard and block performance.
@enejb enejb requested a review from a team September 24, 2025 20:46
@enejb enejb added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review This PR is ready for review. [Package] Forms labels Sep 24, 2025
@enejb enejb changed the title Improve/forms dashboard performance Forms: Improve dashboard initial loading performance Sep 24, 2025
Copy link
Contributor

github-actions bot commented Sep 24, 2025

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

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 [Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form labels Sep 24, 2025
Copy link
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 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!

Copy link

jp-launch-control bot commented Sep 24, 2025

Code Coverage Summary

Cannot generate coverage summary while tests are failing. 🤐

Please fix the tests, or re-run the Code coverage job if it was something being flaky.

Full summary · PHP report · JS report

@enejb enejb force-pushed the improve/forms-dashboard-performance branch from dc5b5c0 to 7d3c417 Compare September 24, 2025 21:25
// Determine if Google Drive setup is complete.
$jetpack_connected = ( new Host() )->is_wpcom_simple() || ( new Connection_Manager( 'jetpack-forms' ) )->is_user_connected( $user_id );
$status['isConnected'] = $jetpack_connected && Google_Drive::has_valid_connection();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@enejb - I'm not quite understanding why we wouldn't want/need this info to be returned on initial load? Like I'd think we might make the endpoint return faster, but only at the cost of not returning useful data? Same question applies to everything we wrapped in this conditional in the PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

We want the initial load fast to be as fast as possible and not wait for a .com request to finish loading. Which caused the page to load slow. Since it block the page from loading.

Instead I think we should load things progressively and only do the work that we need as we need it. Not only would this reduce requests on .com but it would also speed things up.
Since most users are not coming to this page to export stuff to google but to see the form responses.

if ( $is_not_init_load ) {
unset( $config['hasAI'] );
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is causing the test failures. Curious why unset this this, vs just let it default to false as it was doing at the top of the function?

Copy link
Member Author

Choose a reason for hiding this comment

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

I oped to not return a value so that the frontend might realize this and then load this value via the request on request.

Copy link
Contributor

@edanzer edanzer left a comment

Choose a reason for hiding this comment

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

This test well. Approving. But we will need to fix the tests, which are looking for the hasAI key which may or may not exist now given the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [Package] Forms [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