Skip to content

Conversation

dcalhoun
Copy link
Member

@dcalhoun dcalhoun commented Aug 22, 2025

Tip

To avoid reviewing large changes due to relocating files, review each commit individually.

What?

Fix failed REST API requests that fired before GutenbergKit's middleware ran. We introduced these failures when we stopped bundling the @wordpress/api-fetch module in #165.

Why?

Fix CMM-698.

The failed requests lead to broken features.

How?

Strategically load and configure the @wordpress/api-fetch module, so that the configuration middleware completes before the remainder of the modules are loaded from the remote site.

Testing Instructions

  1. Check out the trunk branch.
  2. Open the remote editor in the Demo app (connect to a site with both the Gutenberg and Jetpack plugins).
  3. Inspect the network activity for WebView.
  4. Refresh the page.
  5. Note the failed Jetpack REST API request.
  6. Switch to this PR's branch.
  7. Repeat steps 2-4.
  8. Verify the Jetpack REST API request succeeds with an authorization header.
Screenshot 2025-08-22 at 14 58 27

Accessibility Testing Instructions

N/A, no user-facing changes.

Screenshots or screencast

N/A, no user-facing changes.

Some modules perform fetch requests immediately when loaded. To ensure
these requests use GutenbergKit's fetch configuration, we must load and
configure the `@wordpress/api-fetch` module before loading all others.
The module focuses on loading editor assets.
@dcalhoun dcalhoun added the [Type] Bug An existing feature does not function as intended label Aug 22, 2025
@dcalhoun dcalhoun marked this pull request as ready for review August 22, 2025 18:59
@dcalhoun dcalhoun enabled auto-merge (squash) August 22, 2025 18:59
@dcalhoun dcalhoun requested a review from crazytonyli August 22, 2025 18:59
@dcalhoun dcalhoun merged commit cfa6648 into trunk Aug 25, 2025
11 checks passed
@dcalhoun dcalhoun deleted the fix/authenticate-fetch-requests-occurring-during-the-loading-sequence branch August 25, 2025 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants