@tanstack/history
Advanced tools
Comparing version 1.98.0 to 1.98.1
@@ -152,2 +152,3 @@ const stateIndexKey = "__TSR_index"; | ||
function createBrowserHistory(opts) { | ||
var _a; | ||
const win = (opts == null ? void 0 : opts.window) ?? (typeof document !== "undefined" ? window : void 0); | ||
@@ -164,2 +165,11 @@ const originalPushState = win.history.pushState; | ||
)); | ||
if (!((_a = win.history.state) == null ? void 0 : _a.key)) { | ||
win.history.replaceState( | ||
{ | ||
[stateIndexKey]: 0, | ||
key: createRandomKey() | ||
}, | ||
"" | ||
); | ||
} | ||
let currentLocation = parseLocation(); | ||
@@ -386,3 +396,3 @@ let rollbackLocation; | ||
search: searchIndex > -1 ? href.slice(searchIndex, hashIndex === -1 ? void 0 : hashIndex) : "", | ||
state: state || { [stateIndexKey]: 0 } | ||
state: state || { [stateIndexKey]: 0, key: createRandomKey() } | ||
}; | ||
@@ -389,0 +399,0 @@ } |
{ | ||
"name": "@tanstack/history", | ||
"version": "1.98.0", | ||
"version": "1.98.1", | ||
"description": "Modern and scalable routing for React applications", | ||
@@ -5,0 +5,0 @@ "author": "Tanner Linsley", |
@@ -304,2 +304,13 @@ // While the public API was clearly inspired by the "history" npm package, | ||
// Ensure there is always a key to start | ||
if (!win.history.state?.key) { | ||
win.history.replaceState( | ||
{ | ||
[stateIndexKey]: 0, | ||
key: createRandomKey(), | ||
}, | ||
'', | ||
) | ||
} | ||
let currentLocation = parseLocation() | ||
@@ -619,3 +630,3 @@ let rollbackLocation: HistoryLocation | undefined | ||
: '', | ||
state: state || { [stateIndexKey]: 0 }, | ||
state: state || { [stateIndexKey]: 0, key: createRandomKey() }, | ||
} | ||
@@ -622,0 +633,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
106482
1486