fix: Preload GutenbergKit and invalidate cache for non-Jetpack sites#25226
Open
fix: Preload GutenbergKit and invalidate cache for non-Jetpack sites#25226
Conversation
Add a thread-safe value wrapper for single values and use it to fix the Swift 6 warning on `_lastPluginsFlagValue` in EditorDependencyManager.
Add warmUpEditor(for:) method that combines WebKit warmup with data prefetch, consolidating the warmup logic in a single location.
Call warmUpEditor from MySiteViewController so all site types get editor preloading, including self-hosted sites without Jetpack that display BlogDetailsViewController instead of the dashboard.
Remove warmUpEditorIfNeeded() since warmup is now handled by MySiteViewController through EditorDependencyManager.warmUpEditor().
Move editor cache invalidation from BlogDashboardViewController to MySiteViewController so all site types get cache invalidation on pull-to-refresh. Previously, cache invalidation only happened in BlogDashboardViewController.pulledToRefresh(), which calls viewModel.clearEditorCache(). Non-Jetpack self-hosted sites show BlogDetailsViewController (Site Menu) instead of the dashboard, so the cache invalidation never occurred for these users. Now MySiteViewController.pulledToRefresh() handles cache invalidation for both dashboard and site menu sections, ensuring consistent behavior across all site types.
Collaborator
Generated by 🚫 Danger |
Add comprehensive tests for LockingValue including: - Initialization with various types (primitives, optionals, complex types) - Basic value access (get/set) - withLock operations (read, modify, return results, conditional updates) - Thread safety (concurrent reads, writes, increments, compare-and-swap)
|
Contributor
🤖 Build Failure AnalysisThis build has failures. Claude has analyzed them - check the build annotations for details. |
dcalhoun
commented
Feb 5, 2026
| /// Tracks the `newGutenbergPlugins` flag value at the time the cache was last populated. | ||
| /// Used to detect when the flag changes and invalidate all stale entries. | ||
| private let pluginsFlagLock = NSLock() | ||
| private var _lastPluginsFlagValue: Bool? |
Member
Author
There was a problem hiding this comment.
Replaced with a new LockingValue to address the following warning and mirror LockingHashMap.
Stored property '_lastPluginsFlagValue' of 'Sendable'-conforming class 'EditorDependencyManager' is mutable; this is an error in the Swift 6 language mode
Member
Author
|
The CI failures are seemingly unrelated to these changes and should be addressed by #25224. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This PR fixes editor preloading and cache invalidation for non-Jetpack self-hosted sites. Previously, these features only worked for Jetpack-connected sites because the logic was in
BlogDashboardViewModel, which is only used when displaying the dashboard. Non-Jetpack sites showBlogDetailsViewController(Site Menu) instead.Changes
Add
LockingValue<T>utility - Thread-safe wrapper for single values, fixing Swift 6 Sendable warning on_lastPluginsFlagValueConsolidate editor warmup in
EditorDependencyManager- AddwarmUpEditor(for:)method that combines WebKit warmup with data prefetchMove editor preloading to
MySiteViewController- CallwarmUpEditorfromMySiteViewController.configure(for:)so all site types get editor preloadingMove cache invalidation to
MySiteViewController- CallEditorDependencyManager.invalidate(for:)inpulledToRefresh()so all site types get cache invalidation on pull-to-refreshRemove duplicate code from
BlogDashboardViewModel- RemovewarmUpEditorIfNeeded()andclearEditorCache()methods since this logic is now inMySiteViewControllerRoot cause
Both issues stem from the same architectural problem: non-Jetpack self-hosted sites display
BlogDetailsViewController(Site Menu) instead ofBlogDashboardViewController(Dashboard). The editor warmup and cache invalidation logic was inBlogDashboardViewModel, which is never instantiated for non-Jetpack sites.Fix CMM-1214.
Testing instructions
1. Editor Preloading (Non-Jetpack)
2. Cache Invalidation (Non-Jetpack)
3. Jetpack Sites (Regression Test)