Skip to content

task: add theme styles and third-party blocks toggles to the demo apps - #788

Merged
dcalhoun merged 10 commits into
trunkfrom
task/demo-app-asset-toggles
Oct 14, 2026
Merged

dcalhoun merged 10 commits into
trunkfrom
task/demo-app-asset-toggles

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

What?

Add Demo app feature toggles for theme styles and third-party blocks.

Why?

Simplify testing the editor with and without these features.

How?

  • Add feature toggles for each in the Site Configuration view
  • Disable the toggle if the site lacks support for the feature

Testing Instructions

Note

Theme styles requires the site have the Gutenberg plugin, third-party blocks requires the Jetpack plugins.

  1. Launch the Demo app
  2. Verify the presence of each feature based on the status of the toggle
  3. Verify the toggle is disabled if the site lacks support for the feature

Accessibility Testing Instructions

N/A, unnecessary for the demo app.

Screenshots or screencast

Available Unavailable
available unavailable

AI-generated details

Adds "Enable Theme Styles" and "Enable Third-Party Blocks" toggles to the iOS and Android demo apps' site configuration screens.

  • Each toggle is on by default and disabled when the site lacks support (editor settings or block assets).
  • The editor gets each feature only when the toggle is on and the site supports it.
  • The "Supports Theme Styles" and "Supports Block Assets" rows still show site support, not the toggle state.
  • Changing either toggle or the post type drops prepared dependencies. The toggles and post type picker are disabled while a prepare runs so its result can't overwrite the reset.
  • EditorService reuses cached editor settings and asset bundles regardless of these flags, so a warm cache can still supply them while off. Left for a library follow-up.
  • iOS: the site configuration loads once instead of on every .onAppear, so returning from Browse no longer resets the screen's settings.
  • iOS: editor preparation runs on the main actor.
  • Android: "Prepare Editor" now uses the same built configuration as Start, so it honors the toggles and the selected post type.
  • Android: refreshes the Detekt baseline for FeatureConfigurationCard's new signature.

🤖 Generated with Claude Code

dcalhoun and others added 3 commits October 14, 2026 11:04
Theme styles were always applied when the site supported them, so the
demo apps could not show the editor without them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Block assets were always loaded when the site supported them, so the
demo apps could not show the editor without third-party blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The new toggles change FeatureConfigurationCard's signature, which the
baseline keys its existing LongMethod and LongParameterList entries on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the [Type] Task Issues or PRs that have been broken down into an individual action to take label Oct 14, 2026
@wpmobilebot

wpmobilebot commented Oct 14, 2026 •

Copy link
Copy Markdown

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/788")

Built from 8c3918a

dcalhoun and others added 3 commits October 14, 2026 11:51
Returning from Browse reloads the site configuration, which reset both
toggles to site support while keeping dependencies prepared under the
user's choice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EditorService reuses cached editor settings and asset bundles regardless
of these flags, so prepared dependencies can include them while off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A toggle changed mid-prepare cleared the dependencies, only for the
running prepare to store ones built under the previous setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dcalhoun
dcalhoun marked this pull request as ready for review October 14, 2026 16:13
@dcalhoun
dcalhoun requested a review from nbradbury October 14, 2026 16:15
@nbradbury

Copy link
Copy Markdown
Contributor

@dcalhoun The first finding sounds like it should be addressed.

Severity Location Issue Impact
High SitePreparationViewModel.kt:116 prepareEditor now builds its config with buildConfiguration(), which includes the post type, but setPostType doesn't clear editorDependencies and the picker stays enabled while preparing. Prepare with "post" selected, switch to "page", then tap Start: the editor gets a "page" config with preload data for "post", so the preload entries miss and the UI still reports the stale dependencies as loaded.
Medium SitePreparationView.swift:77 The Post Type picker isn't disabled while preparing, so the race fbcfbf5 fixed for the new toggles is still open for the picker. Tap Prepare, pick "page" before it finishes: the setter nils editorDependencies, then the running Task stores the "post" dependencies (line 433), and Start opens a page editor with the "post" preload list.
Medium SitePreparationView.swift:426 disableButtons = true is set inside the Task started from nonisolated prepareEditor(with:), so the lock comes on late and the write happens off the main actor. A toggle flipped between tapping Prepare and the Task starting clears editorDependencies, and line 433 then stores dependencies built under the old setting.
Medium SitePreparationView.swift:359 siteSupportsThemeStyles/siteSupportsBlockAssets are read from buildOfflineConfiguration's config, which sets both to true unconditionally. Offline, a site without /wp-block-editor/v1/settings shows both toggles as enabled and "Supports Theme Styles" with a green check.
Medium commits b36e1115..fbcfbf54 All six branch commits include a Co-Authored-By: Claude Opus 5.5 trailer, which your global CLAUDE.md forbids. Pushing as-is publishes the trailer, so the commit messages need rewording first.
Low SitePreparationView.swift:362 Re-applying the theme-styles and third-party preferences after reload treats the symptom, since .onAppear re-runs startLoading() on every return from Browse. Coming back from Browse still resets Network Logging, Network Fallback and Native Inserter while keeping the prepared dependencies, and refetches the API root each time; a guard editorConfiguration == nil in startLoading() fixes every toggle.

dcalhoun and others added 4 commits October 14, 2026 12:48
Returning from Browse re-ran the load, which reset every setting on the
screen while keeping the prepared dependencies. This replaces the earlier
re-apply of the feature toggles, which only covered those two.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… change

Prepare now uses the selected post type, so dependencies prepared for one
type no longer matched after switching. The picker also locks while
preparing so a running prepare can't store stale ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The nonisolated helper started its Task off the main actor, so the prepare
lock engaged late and observed state was written from a background thread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its setter clears the prepared dependencies, which the running prepare
then overwrote with ones built for the previous post type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dcalhoun

Copy link
Copy Markdown
Member Author

@nbradbury thanks. I addressed items 1, 2, 3, and 6; these were preexisting. Finding 4 is intentional, it presumes site support when there is no network connection; the negative is a hidden, failed request. Finding 5 appears to be personal Claude configuration on your machine.

@nbradbury nbradbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! :shipit:

@dcalhoun
dcalhoun merged commit bdbd436 into trunk Oct 14, 2026
25 checks passed
@dcalhoun
dcalhoun deleted the task/demo-app-asset-toggles branch October 14, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Task Issues or PRs that have been broken down into an individual action to take

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants