adf0d17497
publish / version_or_publish (push) Has been cancelled
storybook-build / changes (push) Has been cancelled
storybook-build / :storybook-build (push) Has been cancelled
Sync Gradio Skills to Hugging Face / sync-skills (push) Has been cancelled
functional / changes (push) Has been cancelled
functional / build-frontend (push) Has been cancelled
functional / functional-test-SSR=false (push) Has been cancelled
functional / functional-reload (push) Has been cancelled
js / changes (push) Has been cancelled
js / js-test (push) Has been cancelled
docs-build / changes (push) Has been cancelled
docs-build / docs-build (push) Has been cancelled
docs-build / website-build (push) Has been cancelled
functional / functional-test-SSR=true (push) Has been cancelled
hygiene / hygiene-test (push) Has been cancelled
python / changes (push) Has been cancelled
python / build (push) Has been cancelled
python / test-ubuntu-latest-flaky (push) Has been cancelled
python / test-ubuntu-latest-not-flaky (push) Has been cancelled
python / test-windows-latest-flaky (push) Has been cancelled
python / test-windows-latest-not-flaky (push) Has been cancelled
31 lines
1.4 KiB
TypeScript
31 lines
1.4 KiB
TypeScript
import { test, expect } from "@self/tootils";
|
|
|
|
// Regression test for https://github.com/gradio-app/gradio/issues/13198
|
|
//
|
|
// Switching to a tab whose `.select` listener populates a Dataframe used to
|
|
// trigger an infinite reactive loop in the TanStack table adapter (TanStack's
|
|
// automatic page-index reset fired `setState` on every row-model recompute,
|
|
// which our adapter turned into a `version` bump that re-ran the row-model
|
|
// `$derived`, re-firing the reset). That loop saturated the microtask queue
|
|
// and froze the browser tab. These assertions would time out if it regressed.
|
|
test("switching to a tab that populates a dataframe does not freeze", async ({
|
|
page
|
|
}) => {
|
|
const df = page.locator("#tab_df");
|
|
|
|
// No data rows are present before the tab is selected.
|
|
await expect(df.getByTestId("cell-0-1")).toHaveCount(0);
|
|
|
|
await page.getByRole("tab", { name: "Tab 2" }).click();
|
|
|
|
// The select event populates the dataframe with 10 rows (the "Name" column
|
|
// is col 1). If the page froze, these assertions would time out.
|
|
await expect(df.getByTestId("cell-0-1")).toContainText("Item 0");
|
|
await expect(df.getByTestId("cell-9-1")).toContainText("Item 9");
|
|
|
|
// The main thread must still be responsive after rendering: a frozen page
|
|
// could not switch back to Tab 1.
|
|
await page.getByRole("tab", { name: "Tab 1" }).click();
|
|
await expect(page.getByText("Click 'Tab 2'.")).toBeVisible();
|
|
});
|