T
TanStack14mo ago
xenial-black

I want to navigate and have the behavior of window.history.replaceState

Is there a way to navigate() without contributing to the history object? Maybe a different navigate method or a flag I can use or something?
4 Replies
xenial-black
xenial-blackOP14mo ago
replace: true
optimistic-gold
optimistic-gold14mo ago
Using replace: true does still write to window.history, except it in-place makes a replacement instead. TanStack Router pretty much relies on the History API.
optimistic-gold
optimistic-gold14mo ago
MDN Web Docs
History API - Web APIs | MDN
The History API provides access to the browser's session history (not to be confused with WebExtensions history) through the history global object. It exposes useful methods and properties that let you navigate back and forth through the user's history, and manipulate the contents of the history stack.
optimistic-gold
optimistic-gold14mo ago
GitHub
router/packages/history/src/index.ts at main · TanStack/router
🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering. - TanStack/router

Did you find this page helpful?