@@ -205,7 +205,7 @@ test.describe("single-fetch", () => {
205205 let fixture = await createFixture ( {
206206 files,
207207 } ) ;
208- let res = await fixture . requestSingleFetchData ( "/_root .data" ) ;
208+ let res = await fixture . requestSingleFetchData ( "/_ .data" ) ;
209209 expect ( res . data ) . toEqual ( {
210210 root : {
211211 data : {
@@ -1141,7 +1141,7 @@ test.describe("single-fetch", () => {
11411141 expect ( await page . locator ( "#data" ) . innerText ( ) ) . toBe (
11421142 '[["root",{"count":3}],["routes/_index",null]]' ,
11431143 ) ;
1144- expect ( urls ) . toEqual ( [ "/_root .data" ] ) ;
1144+ expect ( urls ) . toEqual ( [ "/_ .data" ] ) ;
11451145 urls . splice ( 0 , urls . length ) ;
11461146
11471147 await app . clickLink ( "/page?optout" ) ;
@@ -1960,7 +1960,7 @@ test.describe("single-fetch", () => {
19601960 await app . clickLink ( "/base/" ) ;
19611961 await expect ( page . getByText ( "Index" ) ) . toBeVisible ( ) ;
19621962
1963- expect ( requests ) . toEqual ( [ "/base/data.data" , "/base/_root .data" ] ) ;
1963+ expect ( requests ) . toEqual ( [ "/base/data.data" , "/base/_ .data" ] ) ;
19641964 } ) ;
19651965
19661966 test ( "processes redirects when a basename is present" , async ( { page } ) => {
@@ -2497,8 +2497,8 @@ test.describe("single-fetch", () => {
24972497
24982498 expect ( await page . innerText ( "[data-submit]" ) ) . toEqual ( "no content!" ) ;
24992499 expect ( requests ) . toEqual ( [
2500- [ "POST" , 204 , "/_root .data?index" ] ,
2501- [ "GET" , 200 , "/_root .data" ] ,
2500+ [ "POST" , 204 , "/_ .data?index" ] ,
2501+ [ "GET" , 200 , "/_ .data" ] ,
25022502 ] ) ;
25032503 } ) ;
25042504
@@ -2538,7 +2538,7 @@ test.describe("single-fetch", () => {
25382538 expect ( await documentRes . text ( ) ) . toBe ( "" ) ;
25392539
25402540 // Data requests
2541- let dataRes = await fixture . requestSingleFetchData ( "/_root .data" ) ;
2541+ let dataRes = await fixture . requestSingleFetchData ( "/_ .data" ) ;
25422542 expect ( dataRes . data ) . toEqual ( {
25432543 root : {
25442544 data : {
@@ -2551,7 +2551,7 @@ test.describe("single-fetch", () => {
25512551 } ,
25522552 } ,
25532553 } ) ;
2554- dataRes = await fixture . requestSingleFetchData ( "/_root .data" , {
2554+ dataRes = await fixture . requestSingleFetchData ( "/_ .data" , {
25552555 headers : {
25562556 "If-None-Match" : "1234" ,
25572557 } ,
@@ -4566,7 +4566,7 @@ test.describe("single-fetch", () => {
45664566 expect ( await app . getHtml ( "h1" ) ) . toMatch ( "It worked!" ) ;
45674567 } ) ;
45684568
4569- test ( "always uses / {path}.data without future.v8_trailingSlashAwareDataRequests flag " , async ( {
4569+ test ( "uses {path}.data or {path}/_.data depending on trailing slash " , async ( {
45704570 page,
45714571 } ) => {
45724572 let fixture = await createFixture ( {
@@ -4644,105 +4644,6 @@ test.describe("single-fetch", () => {
46444644 expect ( await page . locator ( "#pathname" ) . innerText ( ) ) . toEqual ( "/about/" ) ;
46454645 expect ( await page . locator ( "#trailing-slash" ) . innerText ( ) ) . toEqual ( "true" ) ;
46464646
4647- // Client-side navigation with trailing slash
4648- await app . goto ( "/" ) ;
4649- await app . clickLink ( "/about/" ) ;
4650- await page . waitForSelector ( "#pathname" ) ;
4651- expect ( await page . locator ( "#pathname" ) . innerText ( ) ) . toEqual ( "/about" ) ;
4652- expect ( await page . locator ( "#trailing-slash" ) . innerText ( ) ) . toEqual ( "false" ) ;
4653- expect ( requests ) . toEqual ( [ "/about.data" ] ) ;
4654- requests = [ ] ;
4655-
4656- // Client-side navigation back to /
4657- await app . clickLink ( "/" ) ;
4658- await page . waitForSelector ( "h1:has-text('Home')" ) ;
4659- expect ( requests ) . toEqual ( [ "/_root.data" ] ) ;
4660- requests = [ ] ;
4661- } ) ;
4662-
4663- test ( "uses {path}.data or {path}/_.data depending on trailing slash with future.v8_trailingSlashAwareDataRequests flag" , async ( {
4664- page,
4665- } ) => {
4666- let fixture = await createFixture ( {
4667- files : {
4668- ...files ,
4669- "react-router.config.ts" : reactRouterConfig ( {
4670- future : {
4671- v8_trailingSlashAwareDataRequests : true ,
4672- } ,
4673- } ) ,
4674- "app/routes/_index.tsx" : js `
4675- import { Link } from "react-router";
4676-
4677- export default function Index() {
4678- return (
4679- <div>
4680- <h1>Home</h1>
4681- <Link to="/about/">Go to About (with trailing slash)</Link>
4682- <Link to="/about">Go to About (without trailing slash)</Link>
4683- </div>
4684- );
4685- }
4686- ` ,
4687- "app/routes/about.tsx" : js `
4688- import { Link, useLoaderData } from "react-router";
4689-
4690- export function loader({ request }) {
4691- let pathname = new URL(request.url).pathname
4692- .replace(/_\.data$/, "")
4693- .replace(/\.data$/, "");
4694- return {
4695- pathname,
4696- hasTrailingSlash: pathname.endsWith("/"),
4697- };
4698- }
4699-
4700- export default function About() {
4701- let { pathname, hasTrailingSlash } = useLoaderData();
4702- return (
4703- <div>
4704- <h1>About</h1>
4705- <p id="pathname">{pathname}</p>
4706- <p id="trailing-slash">{String(hasTrailingSlash)}</p>
4707- <Link to="/">Go back home</Link>
4708- </div>
4709- );
4710- }
4711- ` ,
4712- } ,
4713- } ) ;
4714- let appFixture = await createAppFixture ( fixture ) ;
4715- let app = new PlaywrightFixture ( appFixture , page ) ;
4716-
4717- let requests : string [ ] = [ ] ;
4718- page . on ( "request" , ( req ) => {
4719- let url = new URL ( req . url ( ) ) ;
4720- if ( url . pathname . endsWith ( ".data" ) ) {
4721- requests . push ( url . pathname + url . search ) ;
4722- }
4723- } ) ;
4724-
4725- // Document load without trailing slash
4726- await app . goto ( "/about" ) ;
4727- await page . waitForSelector ( "#pathname" ) ;
4728- expect ( await page . locator ( "#pathname" ) . innerText ( ) ) . toEqual ( "/about" ) ;
4729- expect ( await page . locator ( "#trailing-slash" ) . innerText ( ) ) . toEqual ( "false" ) ;
4730-
4731- // Client-side navigation without trailing slash
4732- await app . goto ( "/" ) ;
4733- await app . clickLink ( "/about" ) ;
4734- await page . waitForSelector ( "#pathname" ) ;
4735- expect ( await page . locator ( "#pathname" ) . innerText ( ) ) . toEqual ( "/about" ) ;
4736- expect ( await page . locator ( "#trailing-slash" ) . innerText ( ) ) . toEqual ( "false" ) ;
4737- expect ( requests ) . toEqual ( [ "/about.data" ] ) ;
4738- requests = [ ] ;
4739-
4740- // Document load with trailing slash
4741- await app . goto ( "/about/" ) ;
4742- await page . waitForSelector ( "#pathname" ) ;
4743- expect ( await page . locator ( "#pathname" ) . innerText ( ) ) . toEqual ( "/about/" ) ;
4744- expect ( await page . locator ( "#trailing-slash" ) . innerText ( ) ) . toEqual ( "true" ) ;
4745-
47464647 // Client-side navigation with trailing slash
47474648 await app . goto ( "/" ) ;
47484649 await app . clickLink ( "/about/" ) ;
0 commit comments