@@ -1455,6 +1455,82 @@ test.describe("Fog of War", () => {
14551455 expect ( wrongManifestRequests ) . toEqual ( [ ] ) ;
14561456 } ) ;
14571457
1458+ test ( "manifest version mismatch reload should preserve query parameters and hash" , async ( {
1459+ page,
1460+ } ) => {
1461+ let fixture = await createFixture ( {
1462+ files : {
1463+ "app/routes/_index.tsx" : js `
1464+ import { Link, useLocation } from "react-router";
1465+
1466+ export default function Index() {
1467+ const location = useLocation();
1468+ return (
1469+ <div>
1470+ <h1>Home</h1>
1471+ <p data-location>Location: {location.pathname + location.search + location.hash}</p>
1472+ <Link to="/other?token=abc123&ref=campaign#section1">Go to Other</Link>
1473+ </div>
1474+ );
1475+ }
1476+ ` ,
1477+ "app/routes/other.tsx" : js `
1478+ import { useLocation } from "react-router";
1479+
1480+ export default function Other() {
1481+ const location = useLocation();
1482+ return (
1483+ <div>
1484+ <h1>Other Page</h1>
1485+ <p data-location2>Location: {location.pathname + location.search + location.hash}</p>
1486+ </div>
1487+ );
1488+ }
1489+ ` ,
1490+ } ,
1491+ } ) ;
1492+
1493+ // Trigger mismatch + hard reload when trying to patch the /other route
1494+ await page . route ( / \/ _ _ m a n i f e s t / , async ( route ) => {
1495+ if ( route . request ( ) . url ( ) . includes ( encodeURIComponent ( "/other" ) ) ) {
1496+ await route . fulfill ( {
1497+ status : 204 ,
1498+ headers : {
1499+ "X-Remix-Reload-Document" : "true" ,
1500+ } ,
1501+ } ) ;
1502+ } else {
1503+ await route . continue ( ) ;
1504+ }
1505+ } ) ;
1506+
1507+ let appFixture = await createAppFixture ( fixture ) ;
1508+ let app = new PlaywrightFixture ( appFixture , page ) ;
1509+
1510+ // Start on home page
1511+ await app . goto ( "/" ) ;
1512+ await page . waitForSelector ( "h1" ) ;
1513+ await expect ( page . locator ( "[data-location]" ) ) . toHaveText ( "Location: /" ) ;
1514+
1515+ // Click link to /other with query params and hash
1516+ // This should trigger manifest fetch -> version mismatch -> hard reload
1517+ await app . clickLink ( "/other?token=abc123&ref=campaign#section1" ) ;
1518+
1519+ // Wait for the page to reload and render
1520+ await page . waitForSelector ( "[data-location2]" , { timeout : 5000 } ) ;
1521+
1522+ // Query parameters and hash should be preserved after reload
1523+ await expect ( page . locator ( "[data-location2]" ) ) . toHaveText (
1524+ "Location: /other?token=abc123&ref=campaign#section1" ,
1525+ ) ;
1526+
1527+ // Also verify the URL in the browser
1528+ const currentUrl = page . url ( ) ;
1529+ expect ( currentUrl ) . toContain ( "token=abc123" ) ;
1530+ expect ( currentUrl ) . toContain ( "ref=campaign" ) ;
1531+ expect ( currentUrl ) . toContain ( "#section1" ) ;
1532+ } ) ;
1533+
14581534 test . describe ( "routeDiscovery=initial" , ( ) => {
14591535 test ( "loads full manifest on initial load" , async ( { page } ) => {
14601536 let fixture = await createFixture ( {
0 commit comments