-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: Invalidate editor cache when plugins feature flag changes #25170
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
base: release/26.6
Are you sure you want to change the base?
fix: Invalidate editor cache when plugins feature flag changes #25170
Conversation
Generated by 🚫 Danger |
The preloading is unnecessary and also lead to confusing cache states. The invalid cache states were addressed in a separate commit.
Warming and preloading the editor in both the MySiteViewController and BlogDashboardViewModel is redundant. The former embeds the latter.
This is arguably duplicative of the preloading within BlogDashboardViewModel.
When preloading GutenbergKit while plugins are disabled, an empty editor bundle is cached. The editor continues using this this bundle until it expires or the pull-to-refresh gesture is performed on the My Site view. If the plugins feature is later enabled, the empty bundle is used and leads to confusing plugin loading failed warnings. To avoid unexpectedly empty bundles, we invalidate all bundles when the plugins feature flag changes.
GutenbergKit's dependency prefetch manages its own cache and avoids re-fetching dependencies.
9188217 to
17a8262
Compare
|
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 30614 | |
| Version | PR #25170 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 17a8262 | |
| Installation URL | 1o8laergk0gu8 |
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 30614 | |
| Version | PR #25170 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 17a8262 | |
| Installation URL | 7heudll6iv6j0 |
🤖 Build Failure AnalysisThis build has failures. Claude has analyzed them - check the build annotations for details. |
| if let lastFlagValue, lastFlagValue != currentPluginsFlagValue { | ||
| // Flag changed - invalidate all cached entries | ||
| DDLogInfo("EditorDependencyManager: Plugins flag changed (\(lastFlagValue) -> \(currentPluginsFlagValue)), invalidating all cached dependencies") | ||
| cache.removeAll() | ||
| prefetchTasks.removeAll() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix for the unexpected "Plugin loading failed, using default editor configuration" warning.
GutenbergKit's preloading logic returns an empty bundle if plugins is disabled. The app preloaded and cached an empty asset bundle, then continued utilizing it even after the plugins feature was enabled. Invalidating the cache ensure GutenbergKit preloads an appropriate bundle.
|
|
||
| func viewWillAppear() { | ||
| EditorDependencyManager.shared.prefetchDependencies(for: self.blog) | ||
| warmUpEditorIfNeeded(for: self.blog) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduced to avoid unnecessary preloading if GutenbergKit is disabled.
| if RemoteFeatureFlag.newGutenberg.enabled() { | ||
| warmUpEditorIfNeeded(for: blog) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consolidated to BlogDashboardViewModel as it appears to be duplication to have this in both places.
|
|
||
| if let blog = self.blog { | ||
| EditorDependencyManager.shared.prefetchDependencies(for: blog) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed as this feels duplicative of BlogDashboardViewModel. It's difficult (impossible?) to navigate to the post list without first navigating to My Site.





Description
Fix CMM-1174.
This PR fixes an issue where block editor plugins fail to load on fresh app install when the
gutenberg_kit_pluginsfeature flag is toggled after the editor dependencies have been prefetched.Root cause: When the app launches,
EditorDependencyManagerprefetches editor dependencies including asset bundles. If the plugins flag is disabled at that time, an empty asset bundle is cached. When the user later enables the flag and opens the editor, the stale cached empty bundle is used, causing the "Loading plugins failed" notice.Solution:
newGutenbergPluginsflag value when caching dependenciesAdditionally, this PR consolidates editor warmup logic:
warmUpEditorIfNeededfromMySiteViewControllertoBlogDashboardViewModelPostListViewControllerprefetchDependenciesis always called (not guarded by blog change) so flag changes can be detectedTesting instructions
gutenberg_kit_pluginsfeature flag is disabled via the debug menugutenberg_kit_pluginsfeature flag via debug menu