Socket
Socket
Sign inDemoInstall

@tanstack/history

Package Overview
Dependencies
Maintainers
2
Versions
181
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/history - npm Package Compare versions

Comparing version 1.61.0 to 1.61.1

14

dist/esm/index.js

@@ -217,6 +217,4 @@ const pushStateEvent = "pushstate";

let index = opts.initialIndex ?? entries.length - 1;
let currentState = {
key: createRandomKey()
};
const getLocation = () => parseHref(entries[index], currentState);
const states = entries.map(() => ({}));
const getLocation = () => parseHref(entries[index], states[index]);
return createHistory({

@@ -226,6 +224,7 @@ getLocation,

pushState: (path, state) => {
currentState = state;
if (index < entries.length - 1) {
entries.splice(index + 1);
states.splice(index + 1);
}
states.push(state);
entries.push(path);

@@ -235,15 +234,12 @@ index = Math.max(entries.length - 1, 0);

replaceState: (path, state) => {
currentState = state;
states[index] = state;
entries[index] = path;
},
back: () => {
currentState = assignKey(currentState);
index = Math.max(index - 1, 0);
},
forward: () => {
currentState = assignKey(currentState);
index = Math.min(index + 1, entries.length - 1);
},
go: (n) => {
currentState = assignKey(currentState);
index = Math.min(Math.max(index + n, 0), entries.length - 1);

@@ -250,0 +246,0 @@ },

{
"name": "@tanstack/history",
"version": "1.61.0",
"version": "1.61.1",
"description": "Modern and scalable routing for React applications",

@@ -5,0 +5,0 @@ "author": "Tanner Linsley",

@@ -369,7 +369,5 @@ // While the public API was clearly inspired by the "history" npm package,

let index = opts.initialIndex ?? entries.length - 1
let currentState = {
key: createRandomKey(),
} as HistoryState
const states = entries.map(() => ({}) as HistoryState)
const getLocation = () => parseHref(entries[index]!, currentState)
const getLocation = () => parseHref(entries[index]!, states[index])

@@ -380,7 +378,8 @@ return createHistory({

pushState: (path, state) => {
currentState = state
// Removes all subsequent entries after the current index to start a new branch
if (index < entries.length - 1) {
entries.splice(index + 1)
states.splice(index + 1)
}
states.push(state)
entries.push(path)

@@ -390,15 +389,12 @@ index = Math.max(entries.length - 1, 0)

replaceState: (path, state) => {
currentState = state
states[index] = state
entries[index] = path
},
back: () => {
currentState = assignKey(currentState)
index = Math.max(index - 1, 0)
},
forward: () => {
currentState = assignKey(currentState)
index = Math.min(index + 1, entries.length - 1)
},
go: (n) => {
currentState = assignKey(currentState)
index = Math.min(Math.max(index + n, 0), entries.length - 1)

@@ -405,0 +401,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc