Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(assets): name the resolution a hot update misses on

yhh81901f937026
diff --git a/sdk/src/asset/Assets.ts b/sdk/src/asset/Assets.ts
index 337d5aede..2964add44 100644
--- a/sdk/src/asset/Assets.ts
+++ b/sdk/src/asset/Assets.ts
@@ -971,8 +971,8 @@ export class Assets {
// the old pixels while the caller is told `applied: true, failed: 0`. With
// the keys, because a key the cache never saw is what that looks like.
if (changed.length > 0 && oldHandles.size === 0) {
- log.warn('asset', `applyUpdate: ${changed.length} asset(s) changed and none was bound to a live texture`
- + ` — nothing will rebind. keys: ${changed.map((c) => `${c.key} (${c.type})`).join(', ')}`);
+ log.warn('asset', 'applyUpdate: nothing will rebind — no changed asset is bound to a live'
+ + ` texture. ${changed.map((c) => `${c.type} ${c.key} -> ${this.resolveLoadPath_(c.key)}`).join('; ')}`);
}
for (const c of changed) this.fireInvalidate_({ ref: c.key, type: c.type, oldValue: oldHandles.get(c.key) });
// A changed asset is content-addressed, so its next load finds the update
diff --git a/sdk/src/hotUpdateRebind.ts b/sdk/src/hotUpdateRebind.ts
index bf3a2dcd6..aa93e31cc 100644
--- a/sdk/src/hotUpdateRebind.ts
+++ b/sdk/src/hotUpdateRebind.ts
@@ -122,10 +122,24 @@ export function installHotUpdateRebind(app: App, assets: Assets): LiveBindingsDa
}
while (ready.length > 0) {
const { type, oldValue, scope, lease } = ready.shift()!;
- migrateScopeBindings(
+ // Re-acquiring and getting the era the update just ended places the
+ // same pixels back and reads as success everywhere. The cache
+ // answered for a key the revision did not move.
+ if (boundValueOf(lease) === oldValue) {
+ log.warn('asset', `hot-update rebind: re-acquiring "${type}" returned the same value`
+ + ` (${String(oldValue)}) — the update ended an era the cache still serves`);
+ }
+ // It returns whether it placed anything, and the answer was being
+ // dropped: false means the scope held no binding after all, which
+ // is a rebind that did nothing and said nothing.
+ const moved = migrateScopeBindings(
world, scope, type, oldValue,
{ lease, boundValue: boundValueOf }, ownerScopeOf,
);
+ if (!moved) {
+ log.warn('asset', `hot-update rebind: placed nothing for "${type}" at ${String(oldValue)}`
+ + ' — the scope holds no live binding of it, so the old content stays on screen');
+ }
}
if (converged()) for (const wake of waiting.splice(0)) wake();
},