Skip to content

Commit

Permalink
Revert "Fix splat route index matching (#6130)"
Browse files Browse the repository at this point in the history
This reverts commit e48bdff.
  • Loading branch information
brophdawg11 authored Apr 27, 2023
1 parent 8f695fd commit 7fd52aa
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 115 deletions.
5 changes: 0 additions & 5 deletions .changeset/splat-index-matching.md

This file was deleted.

5 changes: 0 additions & 5 deletions integration/revalidate-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ test.describe("Revalidation", () => {
}
`,

"app/routes/_index.jsx": js`
export default function Component() {
return <h1>Index</h1>;
}
`,
"app/routes/parent.jsx": js`
import { json } from "@remix-run/node";
import { Outlet, useLoaderData } from "@remix-run/react";
Expand Down
106 changes: 2 additions & 104 deletions integration/splat-routes-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { test, expect } from "@playwright/test";
import { createFixture, js } from "./helpers/create-fixture";
import type { Fixture } from "./helpers/create-fixture";

let fixture: Fixture;

test.describe("rendering", () => {
let fixture: Fixture;

let ROOT_$ = "FLAT";
let ROOT_INDEX = "ROOT_INDEX";
let FLAT_$ = "FLAT";
Expand Down Expand Up @@ -128,105 +128,3 @@ test.describe("rendering", () => {
expect(await res.text()).toMatch(PARENTLESS_$);
});
});

test.describe("root splat route without index", () => {
test("matches routes correctly (v1)", async ({ page }) => {
fixture = await createFixture({
future: { v2_routeConvention: false },
files: {
"app/routes/$.jsx": js`
export default function Component() {
return <h1>Hello Splat</h1>
}
`,
},
});

let res = await fixture.requestDocument("/");
expect(await res.text()).toMatch("Hello Splat");

res = await fixture.requestDocument("/splat");
expect(await res.text()).toMatch("Hello Splat");

res = await fixture.requestDocument("/splat/deep/path");
expect(await res.text()).toMatch("Hello Splat");
});

test("matches routes correctly (v2)", async ({ page }) => {
fixture = await createFixture({
future: { v2_routeConvention: true },
files: {
"app/routes/$.jsx": js`
export default function Component() {
return <h1>Hello Splat</h1>
}
`,
},
});

let res = await fixture.requestDocument("/");
expect(await res.text()).toMatch("Hello Splat");

res = await fixture.requestDocument("/splat");
expect(await res.text()).toMatch("Hello Splat");

res = await fixture.requestDocument("/splat/deep/path");
expect(await res.text()).toMatch("Hello Splat");
});
});

test.describe("root splat route with index", () => {
test("matches routes correctly (v1)", async ({ page }) => {
fixture = await createFixture({
future: { v2_routeConvention: false },
files: {
"app/routes/index.jsx": js`
export default function Component() {
return <h1>Hello Index</h1>
}
`,
"app/routes/$.jsx": js`
export default function Component() {
return <h1>Hello Splat</h1>
}
`,
},
});

let res = await fixture.requestDocument("/");
expect(await res.text()).toMatch("Hello Index");

res = await fixture.requestDocument("/splat");
expect(await res.text()).toMatch("Hello Splat");

res = await fixture.requestDocument("/splat/deep/path");
expect(await res.text()).toMatch("Hello Splat");
});

test("matches routes correctly (v2)", async ({ page }) => {
fixture = await createFixture({
future: { v2_routeConvention: true },
files: {
"app/routes/_index.jsx": js`
export default function Component() {
return <h1>Hello Index</h1>
}
`,
"app/routes/$.jsx": js`
export default function Component() {
return <h1>Hello Splat</h1>
}
`,
},
});

let res = await fixture.requestDocument("/");
expect(await res.text()).toMatch("Hello Index");

res = await fixture.requestDocument("/splat");
expect(await res.text()).toMatch("Hello Splat");

res = await fixture.requestDocument("/splat/deep/path");
expect(await res.text()).toMatch("Hello Splat");
});
});
1 change: 1 addition & 0 deletions packages/remix-dev/__tests__/readConfig-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe("readConfig", () => {
"root": Object {
"file": "root.tsx",
"id": "root",
"path": "",
},
},
"serverBuildPath": Any<String>,
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ export async function readConfig(
}

let routes: RouteManifest = {
root: { id: "root", file: rootRouteFile },
root: { path: "", id: "root", file: rootRouteFile },
};

let routesConvention: typeof flatRoutes;
Expand Down

0 comments on commit 7fd52aa

Please sign in to comment.