refactor: enforce frontend view model boundaries
Frontend verify / commits (pull_request) Successful in 28s
Frontend verify / security (pull_request) Successful in 10s
Frontend verify / verify (pull_request) Successful in 8m19s

This commit is contained in:
2026-09-28 18:48:23 +03:00
parent 5b69003516
commit ca0ad4f824
287 changed files with 8558 additions and 4538 deletions
+6 -1
View File
@@ -9,6 +9,7 @@ import { instrumentLogoUrl } from "@/shared/lib";
const SEARCH_DEBOUNCE_MS = 300;
type BondsPageVm = ReturnType<typeof useBondsPageVm>;
function useBondsPageVm() {
const [parameters, setParameters] = useSearchParams();
const query = parameters.get("q") ?? "";
@@ -17,6 +18,7 @@ function useBondsPageVm() {
const sync = useScreenSync({ query: debounced, screen: "bonds" }, [result]);
const canSearch = query.trim().length >= MIN_BOND_SEARCH_LENGTH;
const isWaiting = query.trim() !== debounced;
return {
canSearch,
code: apiErrorCode(result.error),
@@ -35,7 +37,10 @@ function useBondsPageVm() {
&& result.meta?.sync.state !== "failed")),
partial: result.meta?.availability === "partial",
query,
ready: debounced.length >= MIN_BOND_SEARCH_LENGTH && !isWaiting && Boolean(result.data),
ready:
debounced.length >= MIN_BOND_SEARCH_LENGTH
&& !isWaiting
&& Boolean(result.data),
refreshing: sync.refreshing,
retry: () => {
void sync.retry();