From 0d08d506c47622cec9537ce7ed2b60d6968e25d6 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Jan 2026 20:22:54 +0000 Subject: [PATCH] Fix plugin loading to respect plugins configuration The EditorService on both iOS and Android was unconditionally calling prepareAssetBundle() regardless of the plugins configuration setting. This caused plugin assets to always be loaded even when plugins were disabled. Added prepareAssetBundleIfEnabled() method that checks the configuration before attempting to load plugin assets: - iOS: Checks configuration.shouldUsePlugins - Android: Checks configuration.plugins When plugins are disabled, the method returns an empty asset bundle immediately instead of attempting to download or read from cache. --- .../org/wordpress/gutenberg/services/EditorService.kt | 11 ++++++++++- .../GutenbergKit/Sources/Services/EditorService.swift | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/android/Gutenberg/src/main/java/org/wordpress/gutenberg/services/EditorService.kt b/android/Gutenberg/src/main/java/org/wordpress/gutenberg/services/EditorService.kt index 8d652b5a..759f09aa 100644 --- a/android/Gutenberg/src/main/java/org/wordpress/gutenberg/services/EditorService.kt +++ b/android/Gutenberg/src/main/java/org/wordpress/gutenberg/services/EditorService.kt @@ -201,7 +201,7 @@ class EditorService( return coroutineScope { val settingsDeferred = async { prepareEditorSettings() } - val assetBundleDeferred = async { prepareAssetBundle() } + val assetBundleDeferred = async { prepareAssetBundleIfEnabled() } val preloadListDeferred = async { preparePreloadList() } // Automatically clean up old asset bundles @@ -269,6 +269,15 @@ class EditorService( return settings } + private suspend fun prepareAssetBundleIfEnabled(): EditorAssetBundle { + if (!configuration.plugins) { + incrementProgress(DependencyWeights.ASSET_BUNDLE) + return EditorAssetBundle.empty + } + + return prepareAssetBundle() + } + private suspend fun prepareAssetBundle(): EditorAssetBundle { val latestAssetBundle = assetLibrary.readAssetBundles().firstOrNull() if (latestAssetBundle != null) { diff --git a/ios/Sources/GutenbergKit/Sources/Services/EditorService.swift b/ios/Sources/GutenbergKit/Sources/Services/EditorService.swift index 8fd3138a..4dbe329e 100644 --- a/ios/Sources/GutenbergKit/Sources/Services/EditorService.swift +++ b/ios/Sources/GutenbergKit/Sources/Services/EditorService.swift @@ -120,7 +120,7 @@ public actor EditorService { self.progressCallback = progress async let settings = try prepareEditorSettings() - async let assetBundle = try self.prepareAssetBundle() + async let assetBundle = try self.prepareAssetBundleIfEnabled() async let preloadList = try preparePreloadList() // Automatically clean up old asset bundles @@ -174,6 +174,15 @@ public actor EditorService { return settings } + private func prepareAssetBundleIfEnabled() async throws -> EditorAssetBundle { + guard configuration.shouldUsePlugins else { + await self.incrementProgress(for: .assetBundle) + return .empty + } + + return try await prepareAssetBundle() + } + private func prepareAssetBundle() async throws -> EditorAssetBundle { if let latestAssetBundle = try await self.assetLibrary.readAssetBundles().first { await self.incrementProgress(for: .assetBundle)