Skip to content

perf: Avoid unnecessary editor assets requests - #126

Merged
dcalhoun merged 2 commits into
trunkfrom
perf/cache-editor-assets-response
May 13, 2025
Merged

dcalhoun merged 2 commits into
trunkfrom
perf/cache-editor-assets-response

Conversation

@dcalhoun

@dcalhoun dcalhoun commented May 12, 2025 •

Copy link
Copy Markdown
Member

What?

Rely upon a cache to avoid unnecessary network requests during editor initialization.

Why?

We invoke loadEditorAssets twice—once for i18n modules, and then again for all other @wordpress modules. The second invocation is performed immediately after the first, and there is no benefit for requesting a new response.

How?

Cache the API endpoint response in memory. Long-term, we plan to cache the response and the assets themselves, which is explored in #107.

Testing Instructions

  1. Test while using a build of the WordPress app with the Gutenberg/experimental editor _plugins debug flag enabled.
  2. Monitor your testing device's network activity.
  3. Open the remote or site-specific editor.
  4. Verify a single request to the editor assets endpoint is performed.

Accessibility Testing Instructions

N/A, no user-facing changes.

Screenshots or screencast

N/A, no user-facing changes.

@dcalhoun dcalhoun added the [Type] Performance Related to performance efforts label May 12, 2025
* @typedef {Object} EditorAssetConfig
*
* @property {string[]} allowedBlockTypes Array of allowed block types provided by the API.
* @property {Object} wpDependencies WordPress dependencies, empty when allowedPackages is provided.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was removed in a separate commit as its usage was removed entirely in an earlier commit.

@dcalhoun
dcalhoun marked this pull request as ready for review May 12, 2025 20:25
@dcalhoun
dcalhoun requested a review from kean May 12, 2025 20:26
Base automatically changed from feat/internationalization to trunk May 12, 2025 20:45
dcalhoun added 2 commits May 12, 2025 16:55
The usage was removed in earlier commits.
We now utilize the `loadEditorAssets` utility twice--once to load i18n
modules, again to load the remaining `@wordpress` modules. The second
invocation occurs immediately after the first, and there is no benefit
from making another network request.
@dcalhoun
dcalhoun force-pushed the perf/cache-editor-assets-response branch from 30c0cec to 45a84bf Compare May 12, 2025 20:55
@dcalhoun

Copy link
Copy Markdown
Member Author

Rebased to exclude the now merged feat/internationalization branch.

@dcalhoun
dcalhoun merged commit db0ed16 into trunk May 13, 2025
@dcalhoun
dcalhoun deleted the perf/cache-editor-assets-response branch May 13, 2025 17:46
jkmassel added a commit that referenced this pull request Aug 12, 2026
…ories

Resolves 29 Dependabot advisories in the dev dependency tree. None of
these packages ship in the iOS/Android app bundle -- they are build,
lint, and local-WP (`@wordpress/env`) tooling.

In-range bumps:
- `vite` 8.0.5 -> 8.2.1 (direct devDep; floor raised to `^8.0.16`) #134 #135
- `shell-quote` -> 1.10.0 (critical #133) #165
- `fast-uri` -> 3.1.5 #163 #164 #179 #206 #207
- `js-yaml` -> 3.15.1 / 4.3.1 #157 #158 #167 #168 #200 #201
- `brace-expansion` #160 #166, `immutable` #161 #162, `tmp` #131,
  `fast-xml-builder` #122 #123, `simple-git` #119,
  `@babel/plugin-transform-modules-systemjs` #126

Scoped `overrides` (parents exact-pinned the vulnerable version):
- `ws` -> 8.21.0, keeping 7.5.13 for `react-devtools-core` #138 #153
- `qs` -> 6.15.2 under `@wordpress/env` #130
- `minimatch` -> 9.0.9 under `@typescript-eslint/typescript-estree` #65
- `@babel/core` -> 7.29.7 under `@wordpress/babel-preset-default` #154

Not addressed here: `electron` (33 alerts) and its bundled `got` (#33)
are pinned by `react-devtools@7.0.1` -- already the latest, and npm's
only "fix" is a breaking downgrade to `react-devtools@1.0.5`.
Runtime-scope advisories (`seroval`, `nanoid`, `postcss`, `showdown`,
`uuid`) are out of scope for a dev-only bump.

Verified: `npm run test:unit` (202 passing) and `npm run build` green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Performance Related to performance efforts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants