Skip to content

Commit f668211

Browse files
committed
call onUpdate on initial load
1 parent 7bf8fd0 commit f668211

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/prefab.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ class Prefab implements PrefabInterface {
221221
projectEnvId: ProjectEnvId,
222222
defaultContext: Contexts
223223
): void {
224-
// Create resolver with a temporary no-op onUpdate for its construction phase
225224
const tempResolver = new Resolver(
226225
configs,
227226
projectEnvId,
@@ -237,7 +236,6 @@ class Prefab implements PrefabInterface {
237236

238237
this.configChangeNotifier.init(tempResolver);
239238

240-
// Define the actual combined onUpdate callback
241239
const actualCombinedOnUpdate = (
242240
updatedConfigs: Array<Config | MinimumConfig>
243241
): void => {
@@ -246,9 +244,11 @@ class Prefab implements PrefabInterface {
246244
};
247245

248246
tempResolver.setOnUpdate(actualCombinedOnUpdate);
249-
250-
// Assign the fully configured resolver to the Prefab instance
251247
this.resolver = tempResolver;
248+
249+
if (configs.length > 0) {
250+
actualCombinedOnUpdate(configs);
251+
}
252252
}
253253

254254
async init({

0 commit comments

Comments
 (0)