From 01a97de55a7b53b55752cd37bb3677e618a7fadf Mon Sep 17 00:00:00 2001 From: bookingseo <68512992+bookingseo@users.noreply.github.com> Date: Sun, 19 Jul 2026 12:14:23 +0700 Subject: [PATCH] fix(domain): memoize the pages-table data slice to stop an infinite render loop (#88) --- e2e/domain-overview-filters.spec.ts | 2 +- e2e/domain-overview-test-utils.ts | 7 +++++-- src/client/features/domain/components/DomainPagesTable.tsx | 6 +++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/e2e/domain-overview-filters.spec.ts b/e2e/domain-overview-filters.spec.ts index c8e9b47..a41cf76 100644 --- a/e2e/domain-overview-filters.spec.ts +++ b/e2e/domain-overview-filters.spec.ts @@ -181,7 +181,7 @@ test.describe("Domain Overview filters", () => { ); await applyFilters(page, "pMinTraffic", "20"); - const domainInput = page.getByPlaceholder("Enter a domain").nth(1); + const domainInput = page.getByPlaceholder("Enter a domain").first(); await domainInput.click(); await domainInput.press( process.platform === "darwin" ? "Meta+A" : "Control+A", diff --git a/e2e/domain-overview-test-utils.ts b/e2e/domain-overview-test-utils.ts index 3cac31b..7cfd65d 100644 --- a/e2e/domain-overview-test-utils.ts +++ b/e2e/domain-overview-test-utils.ts @@ -7,8 +7,11 @@ import { type TestInfo, } from "@playwright/test"; -export const PRIMARY_TEST_DOMAIN = "primary.example"; -export const SECONDARY_TEST_DOMAIN = "secondary.example"; +// Real .com suffix on purpose: form-submit validation (isValidDomainHost via +// tldts) rejects the reserved .example TLD, and these constants reach the one +// test that submits through the real form instead of URL navigation. +export const PRIMARY_TEST_DOMAIN = "primary.example.com"; +export const SECONDARY_TEST_DOMAIN = "secondary.example.com"; const RESPONSIVE_TIMEOUT_MS = 1_500; const INPUT_LATENCY_BUDGET_MS = 8_000; diff --git a/src/client/features/domain/components/DomainPagesTable.tsx b/src/client/features/domain/components/DomainPagesTable.tsx index ffea155..c574a99 100644 --- a/src/client/features/domain/components/DomainPagesTable.tsx +++ b/src/client/features/domain/components/DomainPagesTable.tsx @@ -78,8 +78,12 @@ function DomainPagesTableComponent({ ], [currentSortOrder, domain, onSortClick, sortMode], ); + // Memoized on purpose: a fresh slice every render defeats TanStack Table's + // data-keyed memo, so _autoResetPageIndex fires each render and its setState + // schedules another one — an unbounded render loop that freezes the tab. + const tableData = useMemo(() => rows.slice(0, 100), [rows]); const table = useAppTable({ - data: rows.slice(0, 100), + data: tableData, columns, }); useDomainRenderDebug("DomainPagesTable", {