diff --git a/packages/react-router-dom/__tests__/data-browser-router-test.tsx b/packages/react-router-dom/__tests__/data-browser-router-test.tsx index b1c8ebace3..4b79ef7156 100644 --- a/packages/react-router-dom/__tests__/data-browser-router-test.tsx +++ b/packages/react-router-dom/__tests__/data-browser-router-test.tsx @@ -4263,7 +4263,7 @@ function createDeferred() { function getWindowImpl(initialUrl: string, isHash = false): Window { // Need to use our own custom DOM in order to get a working history - const dom = new JSDOM(``, { url: "https://remix.run/" }); + const dom = new JSDOM(``, { url: "http://localhost/" }); dom.window.history.replaceState(null, "", (isHash ? "#" : "") + initialUrl); return dom.window as unknown as Window; } diff --git a/packages/router/history.ts b/packages/router/history.ts index d6a3d557b3..e8b6c10f7d 100644 --- a/packages/router/history.ts +++ b/packages/router/history.ts @@ -640,7 +640,7 @@ function getUrlBasedHistory( ? window.location.origin : window.location.href; - let href = createHref(window, to); + let href = typeof to === "string" ? to : createPath(to); invariant( base, `No window.location.(origin|href) available to create URL for href: ${href}`