From ab49839ba43b0358ce7a267709b561744eb26eed Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Sun, 10 May 2026 21:26:37 +0200 Subject: [PATCH] fix(#221): provision @resolve: keys via IInitialState MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 12 `@resolve:voorzieningen_register` sentinels in src/manifest.json weren't being resolved at runtime because the lib's useAppManifest only runs sentinel resolution inside the backend-fetch success path, and softwarecatalog has no /api/manifest controller. Beta.30 (PR #220) brought in the resolver but it couldn't fire without backend wiring. This patch provisions every distinct `@resolve:` sentinel via OCP\AppFramework\Services\IInitialState in Application::boot(). The lib's readInitialState() helper calls loadState(appId, key, undefined) synchronously (Step 1 of resolveManifestSentinels.js), so the chain hits initial-state before falling back to the deferred backend fetch (Step 2), unblocking all 12 voorzieningen pages immediately. A full /api/manifest backend controller (Option A) is deferred as a future follow-up — Option B (IInitialState) is the minimal fix. Keys provisioned: voorzieningen_register Closes #221 --- lib/AppInfo/Application.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index dc6fdc74..22b35244 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -63,6 +63,7 @@ use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\AppFramework\Services\IInitialState; use OCP\ICacheFactory; use OCP\IConfig; use OCP\IDBConnection; @@ -447,6 +448,30 @@ public function boot(IBootContext $context): void { // Background jobs are registered declaratively in appinfo/info.xml. // Initialization is handled by the Repair step (InitializeSettings). - // No per-request work needed here. + // Provision IAppConfig keys referenced as `@resolve:` sentinels in + // src/manifest.json so @conduction/nextcloud-vue's resolver chain can + // pick them up synchronously via @nextcloud/initial-state (Step 1) + // without falling through to the deferred backend fetch (Step 2). + // See node_modules/@conduction/nextcloud-vue/src/utils/resolveManifestSentinels.js + // — readInitialState() calls loadState(appId, key, undefined). + $container = $this->getContainer(); + $initialState = $container->get(IInitialState::class); + $appConfig = $container->get(IAppConfig::class); + + // Keys must match every distinct `@resolve:` sentinel in + // src/manifest.json. Discover with: + // grep -oE '@resolve:[a-z_]+' src/manifest.json | sort -u. + $resolveKeys = [ + 'voorzieningen_register', + ]; + foreach ($resolveKeys as $key) { + $value = $appConfig->getValueString(self::APP_ID, $key, ''); + $provisioned = null; + if ($value !== '') { + $provisioned = $value; + } + + $initialState->provideInitialState($key, $provisioned); + } }//end boot() }//end class