Open source alternative to Semrush and Ahrefs
TypeScript backlink-analysisgoogle-search-console-mcpkeyword-researchmcpseoseo-agentseo-auditseo-automationseo-skillsseo-toolssite-audit
fix(domain): memoize the pages-table data slice to stop an infinite render loop (#88)
bookingseo01a97de55a7b
diff --git a/e2e/domain-overview-filters.spec.ts b/e2e/domain-overview-filters.spec.tsindex c8e9b477..a41cf760 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.tsindex 3cac31be..7cfd65d7 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.tsxindex ffea1552..c574a99d 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", {