fix(client): stop retrying failed NameLayer textures; reset font preload in tests

Track permanently failed texture URLs so getTexture does not call PIXI.Assets.load
again after a rejection. Extend resetWarningsForTests to clear failedTextures and
to reset preloadPromise, fontReady, and fontFamily so tests can run preload() and
loadBaseAssets() from a clean state.
This commit is contained in:
scamiv
2026-05-09 02:19:55 +02:00
parent 2adc1486d1
commit 7139a111ab
@@ -17,6 +17,7 @@ export class NameLayerAssets {
private readonly atlasTextures = new Map<string, PIXI.Texture>();
private readonly emojiTextures = new Map<string, PIXI.Texture>();
private readonly pendingTextures = new Map<string, Promise<void>>();
private readonly failedTextures = new Set<string>();
private readonly warnedTextureFailures = new Set<string>();
private readonly warnedMissingEmojis = new Set<string>();
private preloadPromise: Promise<void> | null = null;
@@ -37,6 +38,10 @@ export class NameLayerAssets {
return cached;
}
if (this.failedTextures.has(src)) {
return null;
}
if (!this.pendingTextures.has(src)) {
this.pendingTextures.set(
src,
@@ -46,6 +51,7 @@ export class NameLayerAssets {
})
.catch((error) => {
this.textures.delete(src);
this.failedTextures.add(src);
this.warnTextureFailure(src, error);
})
.finally(() => {
@@ -78,6 +84,10 @@ export class NameLayerAssets {
resetWarningsForTests(): void {
this.warnedTextureFailures.clear();
this.warnedMissingEmojis.clear();
this.failedTextures.clear();
this.preloadPromise = null;
this.fontReady = false;
this.fontFamily = null;
}
private async loadBaseAssets(): Promise<void> {