From f668211e22733bce1fb4348b9d6ff14b6f7a5622 Mon Sep 17 00:00:00 2001 From: James Kebinger Date: Mon, 12 May 2025 11:21:30 -0500 Subject: [PATCH] call onUpdate on initial load --- src/prefab.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/prefab.ts b/src/prefab.ts index f546b4b..a36c1e7 100644 --- a/src/prefab.ts +++ b/src/prefab.ts @@ -221,7 +221,6 @@ class Prefab implements PrefabInterface { projectEnvId: ProjectEnvId, defaultContext: Contexts ): void { - // Create resolver with a temporary no-op onUpdate for its construction phase const tempResolver = new Resolver( configs, projectEnvId, @@ -237,7 +236,6 @@ class Prefab implements PrefabInterface { this.configChangeNotifier.init(tempResolver); - // Define the actual combined onUpdate callback const actualCombinedOnUpdate = ( updatedConfigs: Array ): void => { @@ -246,9 +244,11 @@ class Prefab implements PrefabInterface { }; tempResolver.setOnUpdate(actualCombinedOnUpdate); - - // Assign the fully configured resolver to the Prefab instance this.resolver = tempResolver; + + if (configs.length > 0) { + actualCombinedOnUpdate(configs); + } } async init({