Skip to content

Commit c9308af

Browse files
authored
fix(#221): provision @resolve: keys via IInitialState (#222)
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:<key>` 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
1 parent 5b6b26b commit c9308af

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

lib/AppInfo/Application.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
use OCP\AppFramework\Bootstrap\IBootContext;
6464
use OCP\AppFramework\Bootstrap\IBootstrap;
6565
use OCP\AppFramework\Bootstrap\IRegistrationContext;
66+
use OCP\AppFramework\Services\IInitialState;
6667
use OCP\ICacheFactory;
6768
use OCP\IConfig;
6869
use OCP\IDBConnection;
@@ -447,6 +448,30 @@ public function boot(IBootContext $context): void
447448
{
448449
// Background jobs are registered declaratively in appinfo/info.xml.
449450
// Initialization is handled by the Repair step (InitializeSettings).
450-
// No per-request work needed here.
451+
// Provision IAppConfig keys referenced as `@resolve:<key>` sentinels in
452+
// src/manifest.json so @conduction/nextcloud-vue's resolver chain can
453+
// pick them up synchronously via @nextcloud/initial-state (Step 1)
454+
// without falling through to the deferred backend fetch (Step 2).
455+
// See node_modules/@conduction/nextcloud-vue/src/utils/resolveManifestSentinels.js
456+
// — readInitialState() calls loadState(appId, key, undefined).
457+
$container = $this->getContainer();
458+
$initialState = $container->get(IInitialState::class);
459+
$appConfig = $container->get(IAppConfig::class);
460+
461+
// Keys must match every distinct `@resolve:<key>` sentinel in
462+
// src/manifest.json. Discover with:
463+
// grep -oE '@resolve:[a-z_]+' src/manifest.json | sort -u.
464+
$resolveKeys = [
465+
'voorzieningen_register',
466+
];
467+
foreach ($resolveKeys as $key) {
468+
$value = $appConfig->getValueString(self::APP_ID, $key, '');
469+
$provisioned = null;
470+
if ($value !== '') {
471+
$provisioned = $value;
472+
}
473+
474+
$initialState->provideInitialState($key, $provisioned);
475+
}
451476
}//end boot()
452477
}//end class

0 commit comments

Comments
 (0)