feedback1 ui: operators no longer stay placeholders after a reload or a battle begun in a hidden tab (GitHub #8)
A reload (a phone browser or Chrome's Memory Saver discarding the background tab) made the asset store download
/data/assets.json a second time; createFieldView waited at most 4 s for it, every view looked its model and avatar up
once, and a failed download kept an empty manifest for the page. Now the field host seeds the store with the game
data's copies (seedAssets); without one, ready() retries like data.js, never keeps a failure and tries again with a
bounded backoff, and onChange makes every view re-resolve (UnitView.retryAssets, ItemView.setIcon). A failed or
timed-out Spine load is retried by its view (SPINE_RETRY_MS, acquire { retry }) and at once when the tab is shown.
Battle mode holds the Spine cache (spine.hold()), so a battle that began in a hidden tab keeps its models; the idle
budget still applies and the quiet budget still frees everything in the lobby, room and result.
This commit is contained in:
1 parent
82c54897c7
commit
b7ac003e09
6 files changed
+676
-64
No files matched your search
@@ -485,10 +485,13 @@ describe('createAssets store', () => {
|
||||
assert.equal(a.audio.sfx('battle', 'deploy'), '/sfx/dep.mp3');
|
||||
const warn = console.warn; console.warn = () => {};
|
||||
try {
|
||||
// a failure resolves ready() (fallbacks meanwhile) but is not kept as the manifest (public issue #8 item 5;
|
||||
// test/render/issue8-placeholders.test.js covers the retries)
|
||||
const b = createAssets({ fetch: async () => ({ ok: false, status: 404 }) });
|
||||
await b.ready();
|
||||
assert.deepEqual(await b.ready(), {});
|
||||
assert.equal(b.avatar('char_002_amiya'), null);
|
||||
assert.deepEqual(b.manifest, {});
|
||||
assert.equal(b.manifest, null);
|
||||
assert.equal(b.loaded, false);
|
||||
} finally { console.warn = warn; }
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user