Skip to content

Commit 0ac2b47

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

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/prefab.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ class Prefab implements PrefabInterface {
230230
this.updateIfStalerThan.bind(this),
231231
this.telemetry,
232232
undefined,
233-
() => {},
233+
() => {}, // Start with no-op to avoid premature updates
234234
defaultContext,
235235
this.globalContext
236236
);
237237

238238
this.configChangeNotifier.init(tempResolver);
239239

240-
// Define the actual combined onUpdate callback
240+
// Now that notifier is initialized, set up the actual update callback
241241
const actualCombinedOnUpdate = (
242242
updatedConfigs: Array<Config | MinimumConfig>
243243
): void => {
@@ -246,9 +246,11 @@ class Prefab implements PrefabInterface {
246246
};
247247

248248
tempResolver.setOnUpdate(actualCombinedOnUpdate);
249-
250-
// Assign the fully configured resolver to the Prefab instance
251249
this.resolver = tempResolver;
250+
251+
if (configs.length > 0) {
252+
actualCombinedOnUpdate(configs);
253+
}
252254
}
253255

254256
async init({

0 commit comments

Comments
 (0)