refactor(typography): lazy getTypographySettingsStore + fix effect leak
Convert the eager typographySettingsStore singleton to getTypographySettingsStore() (+ __resetTypographySettingsStore for tests) and update barrels and consumers (TypographyMenu, FontSampler, SampleList, ComparisonView Line/SliderArea, comparisonStore + its mock). Fix a latent leak while here: the store ran $effect.root and discarded the returned cleanup, so its storage-sync effects outlived every instance. Capture the disposer and expose destroy(), which __reset now calls.
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
type ComparisonLine,
|
||||
computeLineRenderModel,
|
||||
} from '$entities/Font';
|
||||
import { typographySettingsStore } from '$features/AdjustTypography';
|
||||
import { getTypographySettingsStore } from '$features/AdjustTypography';
|
||||
import { getComparisonStore } from '../../model';
|
||||
import Character from '../Character/Character.svelte';
|
||||
|
||||
@@ -36,7 +36,7 @@ const comparisonStore = getComparisonStore();
|
||||
|
||||
const model = $derived(computeLineRenderModel(line, split, windowSize));
|
||||
|
||||
const typography = $derived(typographySettingsStore);
|
||||
const typography = getTypographySettingsStore();
|
||||
const fontA = $derived(comparisonStore.fontA);
|
||||
const fontB = $derived(comparisonStore.fontB);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user