Skip to content

fix: skip editor settings fetch when theme styles are disabled#353

Merged
dcalhoun merged 1 commit intotrunkfrom
fix/editor-settings-fetch-guard
Mar 5, 2026
Merged

fix: skip editor settings fetch when theme styles are disabled#353
dcalhoun merged 1 commit intotrunkfrom
fix/editor-settings-fetch-guard

Conversation

@dcalhoun
Copy link
Copy Markdown
Member

@dcalhoun dcalhoun commented Mar 5, 2026

What?

Skip the /wp-block-editor/v1/settings fetch when shouldUseThemeStyles is disabled, regardless of the shouldUsePlugins flag.

Why?

Fix CMM-1921. Fix CMM-1163.

The guard in fetchEditorSettings() previously required both shouldUsePlugins and shouldUseThemeStyles to be false before skipping the fetch. This meant a site with plugins enabled but no support for the block editor settings endpoint would still attempt the fetch, resulting in a 404 error that could cause the editor to fail to load.

The editor settings endpoint is only relevant for theme styles — plugins have their own separate asset endpoint (/wpcom/v2/editor-assets).

How?

Changed the guard condition in fetchEditorSettings() from:

if !shouldUsePlugins && !shouldUseThemeStyles → skip

to:

if !shouldUseThemeStyles → skip

Applied to both iOS (RESTAPIRepository.swift) and Android (RESTAPIRepository.kt), with updated and additional test coverage on both platforms.

Testing Instructions

  1. Configure a site that supports plugins (/wpcom/v2/editor-assets route exists) but does not support the block editor settings endpoint (/wp-block-editor/v1/settings route is absent).
  2. Open the editor for that site.
  3. Verify the editor loads without a 404 error for the settings endpoint.
  4. Verify that a site with both plugins and theme styles enabled still fetches and applies editor settings correctly.

Accessibility Testing Instructions

N/A — no UI changes.

Screenshots or screencast

N/A — no UI changes.

The guard in `fetchEditorSettings()` previously required both
`shouldUsePlugins` and `shouldUseThemeStyles` to be false before
skipping the fetch. This caused a 404 when a site supported plugins
but not the `/wp-block-editor/v1/settings` endpoint.

The editor settings endpoint is only relevant for theme styles, so
the guard now checks `shouldUseThemeStyles` alone.
@dcalhoun dcalhoun added the [Type] Bug An existing feature does not function as intended label Mar 5, 2026
@dcalhoun dcalhoun marked this pull request as ready for review March 5, 2026 20:51
@dcalhoun dcalhoun requested a review from jkmassel March 5, 2026 20:51
Copy link
Copy Markdown
Contributor

@jkmassel jkmassel left a comment

Choose a reason for hiding this comment

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

With these changes, I was able to load the site that was erroring before the changes.

@dcalhoun dcalhoun merged commit ba7c9c2 into trunk Mar 5, 2026
14 checks passed
@dcalhoun dcalhoun deleted the fix/editor-settings-fetch-guard branch March 5, 2026 23:01
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