Refactor/reacrhitecture to fsd+ #49

Merged
ilia merged 70 commits from refactor/reacrhitecture-to-fsd+ into main 2026-06-03 09:55:47 +00:00
5 changed files with 27 additions and 13 deletions
Showing only changes of commit 28a8e49915 - Show all commits
+10 -1
View File
@@ -1,4 +1,3 @@
export * from './api';
export * from './domain'; export * from './domain';
export * from './lib'; export * from './lib';
export * from './ui'; export * from './ui';
@@ -8,6 +7,16 @@ export * from './ui';
export * from './model/const/const'; export * from './model/const/const';
export * from './model/types'; export * from './model/types';
/*
* `./api` (proxy clients: `fetchProxyFonts`, `seedFontCache`, …) is intentionally
* NOT re-exported here. Those clients import `$shared/api/queryClient`, whose
* module eval runs `new QueryClient()` and loads `@tanstack/query-core`. Funneling
* them through this barrel made every consumer of `$entities/Font` — including
* pure-domain and type-only importers — eager-load TanStack and construct the
* client (notably in unit specs). Import API clients via the segment:
* import { fetchProxyFonts } from '$entities/Font/api';
*/
/* /*
* Stores (`fontCatalogStore`, `fontLifecycleManager`, `FontsByIdsStore`) are * Stores (`fontCatalogStore`, `fontLifecycleManager`, `FontsByIdsStore`) are
* intentionally NOT re-exported here. They instantiate module-level singletons * intentionally NOT re-exported here. They instantiate module-level singletons
+1 -1
View File
@@ -1,4 +1,4 @@
import { NonRetryableError } from '$shared/api/queryClient'; import { NonRetryableError } from '$shared/api/nonRetryableError';
/** /**
* Thrown when the network request to the proxy API fails. * Thrown when the network request to the proxy API fails.
@@ -9,7 +9,7 @@
import { api } from '$shared/api/api'; import { api } from '$shared/api/api';
import { API_ENDPOINTS } from '$shared/api/endpoints'; import { API_ENDPOINTS } from '$shared/api/endpoints';
import { NonRetryableError } from '$shared/api/queryClient'; import { NonRetryableError } from '$shared/api/nonRetryableError';
const PROXY_API_URL = API_ENDPOINTS.filters; const PROXY_API_URL = API_ENDPOINTS.filters;
+14
View File
@@ -0,0 +1,14 @@
/**
* Marker base class for errors that retrying will never fix — schema-validation
* failures, unauthorized responses, contract violations, etc.
*
* The queryClient retry handler short-circuits when it sees this; without it,
* a non-transient backend bug pins the UI through the full retry budget
* (default 3× exponential backoff ≈ 7s).
*
* Lives in its own module — free of `@tanstack/query-core` — so error types that
* extend it (e.g. `FontResponseError`) can be imported without dragging the
* TanStack client and its eager `new QueryClient()` instantiation into the
* importer's module graph. See the barrel-coupling notes in the FSD audit.
*/
export class NonRetryableError extends Error {}
+1 -10
View File
@@ -1,14 +1,5 @@
import { QueryClient } from '@tanstack/query-core'; import { QueryClient } from '@tanstack/query-core';
import { NonRetryableError } from './nonRetryableError';
/**
* Marker base class for errors that retrying will never fix — schema-validation
* failures, unauthorized responses, contract violations, etc.
*
* The queryClient retry handler short-circuits when it sees this; without it,
* a non-transient backend bug pins the UI through the full retry budget
* (default 3× exponential backoff ≈ 7s).
*/
export class NonRetryableError extends Error {}
/** /**
* Data remains fresh for this long after fetch. Stores that override * Data remains fresh for this long after fetch. Stores that override