Skip to content

feat: Preload editor settings within My Site #21815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: feat/provide-editor-settings
Choose a base branch
from

Conversation

dcalhoun
Copy link
Member

@dcalhoun dcalhoun commented Apr 18, 2025

Improve editor load speed through preloading the editor settings.

Testing instructions

Important

Enabling the Experimental block editor feature is required.

1: My Site without cache fetches editor settings

  1. Observe the network activity of the app.
  2. Install and launch the app.
  3. Switch sites.
  4. Verify a successful editor settings endpoint request is performed.

2: My Site with cache does not fetch editor settings

  1. Switch to a previous site selected in test case 1.
  2. Verify an editor settings endpoint request is not performed.

3: Editor utilizes stale-while-revalidate caching

  1. Open the editor.
  2. Verify a successful editor settings endpoint request is performed.
  3. Repeat steps one and two.

@dcalhoun dcalhoun added [Type] Enhancement Gutenberg Editing and display of Gutenberg blocks. labels Apr 18, 2025
@dcalhoun dcalhoun force-pushed the feat/preload-editor-settings-in-my-site branch from fec3cd1 to 4235427 Compare April 18, 2025 16:37
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Apr 18, 2025

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr21815-7a03644
Commit7a03644
Direct Downloadwordpress-prototype-build-pr21815-7a03644.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Apr 18, 2025

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr21815-7a03644
Commit7a03644
Direct Downloadjetpack-prototype-build-pr21815-7a03644.apk
Note: Google Login is not supported on these builds.

@dcalhoun dcalhoun force-pushed the feat/provide-editor-settings branch from bf0f0ca to 234d290 Compare April 21, 2025 15:09
Improve load speed of editor.
Avoid redundant network requests triggered each time My Site is
displayed. The stale-while-revalidate approach remains used when the
editor is opened, meaning the latest editor settings are always fetched
on each editor open event.
@dcalhoun dcalhoun force-pushed the feat/preload-editor-settings-in-my-site branch from 59d259f to 802c445 Compare April 21, 2025 15:12
Ensure the remote feature flag is taken into consideration for editor
settings fetching.
@dcalhoun dcalhoun marked this pull request as ready for review April 21, 2025 15:22
@dcalhoun dcalhoun requested a review from Copilot April 21, 2025 21:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves editor load speed by preloading editor settings, leveraging caching to avoid unnecessary network requests. Key changes include:

  • Adding a new optional parameter (skipNetworkIfCacheExists) to the FetchEditorSettingsPayload in EditorSettingsStore.kt and updating the fetch logic.
  • Removing EditorSettingsStore dependency injection in EditPostActivity.kt to clean up unused references.
  • Updating SelectedSiteRepository.kt to dispatch editor settings actions based on experimental feature flags and adding new dependencies.
  • Injecting EditorSettingsStore in WPMainActivity.java to ensure the store processes dispatched actions.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
libs/fluxc/src/main/java/org/wordpress/android/fluxc/store/EditorSettingsStore.kt Introduces a new payload parameter, modifies fetchEditorSettings to support caching logic.
WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt Removes unused injection of EditorSettingsStore.
WordPress/src/main/java/org/wordpress/android/ui/mysite/SelectedSiteRepository.kt Adds feature-flag-based logic to fetch editor settings and updates dependency injections.
WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java Injects EditorSettingsStore to ensure the store responds to dispatched actions.

@dcalhoun dcalhoun requested a review from nbradbury April 21, 2025 21:22
@nbradbury nbradbury self-assigned this Apr 22, 2025
Copy link
Contributor

@nbradbury nbradbury left a comment

Choose a reason for hiding this comment

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

@dcalhoun This tested fine and code looks good, but there are failing tests that should be addressed.

References to feature flags and experimental features introduced test
failures.
Assert new conditional logic based on experimental features.
Copy link

codecov bot commented Apr 23, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 39.32%. Comparing base (234d290) to head (7a03644).

Files with missing lines Patch % Lines
...dpress/android/ui/mysite/SelectedSiteRepository.kt 75.00% 1 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##           feat/provide-editor-settings   #21815   +/-   ##
=============================================================
  Coverage                         39.32%   39.32%           
=============================================================
  Files                              2125     2125           
  Lines                             99871    99871           
  Branches                          15385    15385           
=============================================================
  Hits                              39277    39277           
  Misses                            57114    57114           
  Partials                           3480     3480           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dcalhoun dcalhoun requested a review from nbradbury April 23, 2025 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gutenberg Editing and display of Gutenberg blocks. [Type] Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants