Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(react-server): simplify route tree utils #338

Merged
merged 16 commits into from
Jun 4, 2024
8 changes: 3 additions & 5 deletions packages/react-server/examples/basic/e2e/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ testNoJs("catch-all routes @nojs", async ({ page }) => {
await testCatchallRoute(page, { js: false });
});

async function testCatchallRoute(page: Page, options: { js: boolean }) {
async function testCatchallRoute(page: Page, _options: { js: boolean }) {
await page
.getByRole("link", { name: "• /test/dynamic/catchall/static" })
.click();
Expand Down Expand Up @@ -904,10 +904,8 @@ async function testCatchallRoute(page: Page, options: { js: boolean }) {
.click();
await page.getByText("file: /test/dynamic/catchall").click();
await page.getByText('params: {"any":"x/y/w"}').click();
// state is preserved
await expect(page.getByLabel("test state")).toBeChecked({
checked: options.js,
});
// state is not preserved
await expect(page.getByLabel("test state")).not.toBeChecked();
}

test("full client route", async ({ page }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-server/src/entry/react-server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
createError,
getErrorContext,
} from "../lib/error";
import { generateRouteTree, renderRouteMap } from "../lib/router";
import { generateRouteModuleTree, renderRouteMap } from "../lib/router";

const debug = createDebug("react-server:rsc");

Expand Down Expand Up @@ -147,7 +147,7 @@ function createRouter() {
eager: true,
},
);
const tree = generateRouteTree(
const tree = generateRouteModuleTree(
objectMapKeys(glob, (_v, k) => k.slice("/src/routes".length)),
);

Expand Down
Loading