Automattic / Automattic/jetpack

Admin Performance: Deactivation Dialogue impact on plugins.php

Open
#22,664 0 comments 0 reactions 0 assignees View on GitHub
[Focus] Performance [Plugin] Jetpack Enhancement Task
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

### Impacted plugin

Jetpack

### Steps to Reproduce

Visit `wp-admin/plugins.php`

### A clear and concise description of what you expected to happen.

Get license data from wp.com API after the plugins page has loaded.

### What actually happened

`Jetpack_Redux_State_Helper::get_initial_state` - While preparing the Redux initial state, it does things like talking to the WordPress.com API to find out what kind of licenses the current user has available.

### Other information

When loading plugins.php, my test site spends a good ~300ms, or 30% of the TTFB inside `Jetpack_Redux_State_Helper::get_initial_state` gathering things in case the user triggers the Jetpack Deactivation dialog.

![image](https://user-images.githubusercontent.com/7129409/152530027-1e5295be-0115-47d6-a3e8-09de541aa3ee.png)

While preparing the Redux initial state, it does things like talking to the WordPress.com API to find out what kind of licenses the current user has available:

![image](https://user-images.githubusercontent.com/7129409/152530045-3058ffa8-647d-4bdd-a998-63030a458d77.png)

If this can be moved out of the initial requests, and instead be pulled by the JavaScript after loading the plugins page, it will make that page substantially faster.

Internal reference: p1HpG7-ere-p2#comment-52144

### Operating System

_No response_

### OS Version

_No response_

### Browser

Chrome/Chromium

### Browser Version(s)

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at wp-admin/plugins.php and Jetpack_Redux_State_Helper::get_initial_state, then trace the license-data requests to the WordPress.com API. Measure the current page-load cost and determine how the deactivation dialogue obtains the same data after the page has loaded. Done means plugins.php no longer performs this work during its initial request while the dialogue still receives the required license data.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
backend-api-design, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.