From c09ca93f4ecbfe598b521d5814cbe0797a64792c Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Wed, 3 Jun 2026 10:52:29 +0300 Subject: [PATCH] perf(test): stop typographySettings pulling @tanstack for four constants typographySettingsStore (and its spec) imported DEFAULT_FONT_* from the $entities/Font root barrel, which re-exports FontVirtualList -> stores -> @tanstack/query-core. Under Vitest (no tree-shaking) that loaded the entire UI + TanStack graph just to read four constants. Import them from the pure $entities/Font/model/const/const module instead. Deep path is deliberate: it pulls only the constants, not the entity store graph. Mitigates the test-side cost of audit D-1 (root barrel not yet inert); the structural fix (inject stores into FontVirtualList) stays parked. --- .../typographySettingsStore.svelte.ts | 5 ++++- .../typographySettingsStore/typographySettingsStore.test.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.svelte.ts b/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.svelte.ts index dff832c..22576a9 100644 --- a/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.svelte.ts +++ b/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.svelte.ts @@ -15,7 +15,10 @@ import { DEFAULT_FONT_WEIGHT, DEFAULT_LETTER_SPACING, DEFAULT_LINE_HEIGHT, -} from '$entities/Font'; + // Deep path (not the root barrel) on purpose: pulls only these pure + // constants, not the entity's UI/store graph (+ @tanstack) — keeps this + // feature store and its spec light at import. See audit D-1. +} from '$entities/Font/model/const/const'; import { type PersistentStore, createPersistentStore, diff --git a/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.test.ts b/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.test.ts index 4b81e47..cbb0390 100644 --- a/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.test.ts +++ b/src/features/AdjustTypography/model/store/typographySettingsStore/typographySettingsStore.test.ts @@ -6,7 +6,7 @@ import { DEFAULT_FONT_WEIGHT, DEFAULT_LETTER_SPACING, DEFAULT_LINE_HEIGHT, -} from '$entities/Font'; +} from '$entities/Font/model/const/const'; import { beforeEach, describe,