feat(ComparisonStore): pin fontA/fontB to prevent eviction while on-screen

This commit is contained in:
Ilia Mashkov
2026-04-16 10:55:41 +03:00
parent e509463911
commit d2bce85f9c
2 changed files with 81 additions and 2 deletions

View File

@@ -134,6 +134,19 @@ export class ComparisonStore {
});
}
});
// Effect 4: Pin fontA/fontB so eviction never removes on-screen fonts
$effect(() => {
const fa = this.#fontA;
const fb = this.#fontB;
const w = typographySettingsStore.weight;
if (fa) appliedFontsManager.pin(fa.id, w, fa.features?.isVariable);
if (fb) appliedFontsManager.pin(fb.id, w, fb.features?.isVariable);
return () => {
if (fa) appliedFontsManager.unpin(fa.id, w, fa.features?.isVariable);
if (fb) appliedFontsManager.unpin(fb.id, w, fb.features?.isVariable);
};
});
});
}