@@ -220,6 +220,9 @@ test.describe("route module link export", () => {
220
220
<li>
221
221
<Link to="/resources">Resource routes</Link>
222
222
</li>
223
+ <li>
224
+ <Link to="/parent/child">Errored child route</Link>
225
+ </li>
223
226
</ul>
224
227
</nav>
225
228
</div>
@@ -471,6 +474,42 @@ test.describe("route module link export", () => {
471
474
}
472
475
473
476
` ,
477
+
478
+ "app/routes/parent.jsx" : js `
479
+ import { Outlet } from "@remix-run/react";
480
+
481
+ export function links() {
482
+ return [
483
+ { "data-test-id": "red" },
484
+ ];
485
+ }
486
+
487
+ export default function Component() {
488
+ return <div data-test-id="/parent"><Outlet /></div>;
489
+ }
490
+
491
+ export function ErrorBoundary() {
492
+ return <h1 data-test-id="/parent:error-boundary">Error Boundary</h1>;
493
+ }
494
+ ` ,
495
+
496
+ "app/routes/parent.child.jsx" : js `
497
+ import { Outlet } from "@remix-run/react";
498
+
499
+ export function loader() {
500
+ throw new Response(null, { status: 404 });
501
+ }
502
+
503
+ export function links() {
504
+ return [
505
+ { "data-test-id": "blue" },
506
+ ];
507
+ }
508
+
509
+ export default function Component() {
510
+ return <div data-test-id="/parent"><Outlet /></div>;
511
+ }
512
+ ` ,
474
513
} ,
475
514
} ) ;
476
515
appFixture = await createAppFixture ( fixture ) ;
@@ -511,6 +550,17 @@ test.describe("route module link export", () => {
511
550
expect ( stylesheetResponses . length ) . toEqual ( 1 ) ;
512
551
} ) ;
513
552
553
+ test ( "does not render errored child route links" , async ( { page } ) => {
554
+ let app = new PlaywrightFixture ( appFixture , page ) ;
555
+ await app . goto ( "/" , true ) ;
556
+ await page . click ( 'a[href="/parent/child"]' ) ;
557
+ await page . waitForSelector ( '[data-test-id="/parent:error-boundary"]' ) ;
558
+ await page . waitForSelector ( '[data-test-id="red"]' , { state : "attached" } ) ;
559
+ await page . waitForSelector ( '[data-test-id="blue"]' , {
560
+ state : "detached" ,
561
+ } ) ;
562
+ } ) ;
563
+
514
564
test . describe ( "no js" , ( ) => {
515
565
test . use ( { javaScriptEnabled : false } ) ;
516
566
@@ -534,6 +584,16 @@ test.describe("route module link export", () => {
534
584
let locator = page . locator ( "link[rel=preload][as=image]" ) ;
535
585
expect ( await locator . getAttribute ( "imagesizes" ) ) . toBe ( "100vw" ) ;
536
586
} ) ;
587
+
588
+ test ( "does not render errored child route links" , async ( { page } ) => {
589
+ let app = new PlaywrightFixture ( appFixture , page ) ;
590
+ await app . goto ( "/parent/child" ) ;
591
+ await page . waitForSelector ( '[data-test-id="/parent:error-boundary"]' ) ;
592
+ await page . waitForSelector ( '[data-test-id="red"]' , { state : "attached" } ) ;
593
+ await page . waitForSelector ( '[data-test-id="blue"]' , {
594
+ state : "detached" ,
595
+ } ) ;
596
+ } ) ;
537
597
} ) ;
538
598
539
599
test . describe ( "script imports" , ( ) => {
0 commit comments