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

Omit search part of path when detecting if the route changed after downloading asset bundles #6707

Merged
merged 5 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/remix-dev/__tests__/cli-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ describe("remix CLI", () => {
await interactWithShell(proc, [
{ question: /Where.*create.*app/i, type: [projectDir, ENTER] },
{ question: /What type of app/i, answer: /basics/i },
{ question: /Where.*deploy/i, answer: /express/i },
{ question: /Where.*deploy/i, answer: /remix/i },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this unit test fix - this was fixed in dev and cherry-picked into main and release-next. This branch has the main SHA since I merged main in - but this code is already in release-next so it's not actually changing anything.

{ question: /typescript or javascript/i, answer: /typescript/i },
{ question: /install/i, type: ["n", ENTER] },
]);
Expand All @@ -255,7 +255,7 @@ describe("remix CLI", () => {
await interactWithShell(proc, [
{ question: /Where.*create.*app/i, type: [projectDir, ENTER] },
{ question: /What type of app/i, answer: /basics/i },
{ question: /Where.*deploy/i, answer: /express/i },
{ question: /Where.*deploy/i, answer: /remix/i },
{ question: /typescript or javascript/i, answer: /javascript/i },
{ question: /install/i, type: ["n", ENTER] },
]);
Expand Down
12 changes: 6 additions & 6 deletions packages/remix-react/browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
/* eslint-disable prefer-let/prefer-let */
declare global {
var __remixContext: {
url: string;
pathname: string;
state: HydrationState;
future: FutureConfig;
// The number of active deferred keys rendered on the server
Expand Down Expand Up @@ -186,12 +186,12 @@ export function RemixBrowser(_props: RemixBrowserProps): ReactElement {
// external site into a Remix app, where we initially start the load for
// one URL and while the JS chunks are loading a second forward click moves
// us to a new URL
let initialUrl = window.__remixContext.url;
let hydratedUrl = window.location.pathname + window.location.search;
if (initialUrl !== hydratedUrl) {
let initialPathname = window.__remixContext.pathname;
let hydratedPathname = window.location.pathname;
if (initialPathname !== hydratedPathname) {
let errorMsg =
`Initial URL (${initialUrl}) does not match URL at time of hydration ` +
`(${hydratedUrl}), reloading page...`;
`Initial URL (${initialPathname}) does not match URL at time of hydration ` +
`(${hydratedPathname}), reloading page...`;
console.error(errorMsg);
window.location.reload();
}
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-server-runtime/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ async function handleDocumentRequestRR(
routeModules: createEntryRouteModules(build.routes),
staticHandlerContext: context,
serverHandoffString: createServerHandoffString({
url: context.location.pathname + context.location.search,
pathname: context.location.pathname,
state: {
loaderData: context.loaderData,
actionData: context.actionData,
Expand Down Expand Up @@ -335,7 +335,7 @@ async function handleDocumentRequestRR(
...entryContext,
staticHandlerContext: context,
serverHandoffString: createServerHandoffString({
url: context.location.pathname + context.location.search,
pathname: context.location.pathname,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we consider this handoff format public API? If so can we not re-name the property here and re-purpose the "url" name?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 9c6cf2f

state: {
loaderData: context.loaderData,
actionData: context.actionData,
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-server-runtime/serverHandoff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function createServerHandoffString<T>(serverHandoff: {
// Don't allow StaticHandlerContext to be passed in verbatim, since then
// we'd end up including duplicate info
state: ValidateShape<T, HydrationState>;
url: string;
pathname: string;
future: FutureConfig;
dev?: { port: number };
}): string {
Expand Down