You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@tanstack/store

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/store - npm Package Compare versions

Comparing version
0.7.5
to
0.7.6
+7
-5
dist/cjs/derived.cjs

@@ -11,7 +11,9 @@ "use strict";

this.getDepVals = () => {
const prevDepVals = [];
const currDepVals = [];
for (const dep of this.options.deps) {
prevDepVals.push(dep.prevState);
currDepVals.push(dep.state);
const l = this.options.deps.length;
const prevDepVals = new Array(l);
const currDepVals = new Array(l);
for (let i = 0; i < l; i++) {
const dep = this.options.deps[i];
prevDepVals[i] = dep.prevState;
currDepVals[i] = dep.state;
}

@@ -18,0 +20,0 @@ this.lastSeenDepValues = currDepVals;

@@ -36,16 +36,18 @@ "use strict";

function __notifyListeners(store) {
store.listeners.forEach(
(listener) => listener({
prevVal: store.prevState,
currentVal: store.state
})
);
const value = {
prevVal: store.prevState,
currentVal: store.state
};
for (const listener of store.listeners) {
listener(value);
}
}
function __notifyDerivedListeners(derived2) {
derived2.listeners.forEach(
(listener) => listener({
prevVal: derived2.prevState,
currentVal: derived2.state
})
);
const value = {
prevVal: derived2.prevState,
currentVal: derived2.state
};
for (const listener of derived2.listeners) {
listener(value);
}
}

@@ -96,3 +98,3 @@ function __flush(store) {

if (__batchDepth === 0) {
const pendingUpdateToFlush = Array.from(__pendingUpdates)[0];
const pendingUpdateToFlush = __pendingUpdates.values().next().value;
if (pendingUpdateToFlush) {

@@ -99,0 +101,0 @@ __flush(pendingUpdateToFlush);

@@ -13,4 +13,4 @@ /**

export interface ListenerValue<T> {
prevVal: T;
currentVal: T;
readonly prevVal: T;
readonly currentVal: T;
}

@@ -17,0 +17,0 @@ /**

@@ -9,7 +9,9 @@ import { Store } from "./store.js";

this.getDepVals = () => {
const prevDepVals = [];
const currDepVals = [];
for (const dep of this.options.deps) {
prevDepVals.push(dep.prevState);
currDepVals.push(dep.state);
const l = this.options.deps.length;
const prevDepVals = new Array(l);
const currDepVals = new Array(l);
for (let i = 0; i < l; i++) {
const dep = this.options.deps[i];
prevDepVals[i] = dep.prevState;
currDepVals[i] = dep.state;
}

@@ -16,0 +18,0 @@ this.lastSeenDepValues = currDepVals;

@@ -34,16 +34,18 @@ import { Derived } from "./derived.js";

function __notifyListeners(store) {
store.listeners.forEach(
(listener) => listener({
prevVal: store.prevState,
currentVal: store.state
})
);
const value = {
prevVal: store.prevState,
currentVal: store.state
};
for (const listener of store.listeners) {
listener(value);
}
}
function __notifyDerivedListeners(derived) {
derived.listeners.forEach(
(listener) => listener({
prevVal: derived.prevState,
currentVal: derived.state
})
);
const value = {
prevVal: derived.prevState,
currentVal: derived.state
};
for (const listener of derived.listeners) {
listener(value);
}
}

@@ -94,3 +96,3 @@ function __flush(store) {

if (__batchDepth === 0) {
const pendingUpdateToFlush = Array.from(__pendingUpdates)[0];
const pendingUpdateToFlush = __pendingUpdates.values().next().value;
if (pendingUpdateToFlush) {

@@ -97,0 +99,0 @@ __flush(pendingUpdateToFlush);

@@ -13,4 +13,4 @@ /**

export interface ListenerValue<T> {
prevVal: T;
currentVal: T;
readonly prevVal: T;
readonly currentVal: T;
}

@@ -17,0 +17,0 @@ /**

{
"name": "@tanstack/store",
"version": "0.7.5",
"version": "0.7.6",
"description": "Framework agnostic type-safe store w/ reactive framework adapters",

@@ -44,3 +44,3 @@ "author": "Tanner Linsley",

"devDependencies": {
"@angular/core": "^19.2.14",
"@angular/core": "^19.2.15",
"@preact/signals": "^1.3.2",

@@ -47,0 +47,0 @@ "solid-js": "^1.9.9",

@@ -80,7 +80,9 @@ import { Store } from './store'

getDepVals = () => {
const prevDepVals = [] as Array<unknown>
const currDepVals = [] as Array<unknown>
for (const dep of this.options.deps) {
prevDepVals.push(dep.prevState)
currDepVals.push(dep.state)
const l = this.options.deps.length
const prevDepVals = new Array<unknown>(l)
const currDepVals = new Array<unknown>(l)
for (let i = 0; i < l; i++) {
const dep = this.options.deps[i]!
prevDepVals[i] = dep.prevState
currDepVals[i] = dep.state
}

@@ -87,0 +89,0 @@ this.lastSeenDepValues = currDepVals

@@ -68,17 +68,19 @@ import { Derived } from './derived'

function __notifyListeners(store: Store<unknown>) {
store.listeners.forEach((listener) =>
listener({
prevVal: store.prevState as never,
currentVal: store.state as never,
}),
)
const value = {
prevVal: store.prevState as never,
currentVal: store.state as never,
}
for (const listener of store.listeners) {
listener(value)
}
}
function __notifyDerivedListeners(derived: Derived<unknown>) {
derived.listeners.forEach((listener) =>
listener({
prevVal: derived.prevState as never,
currentVal: derived.state as never,
}),
)
const value = {
prevVal: derived.prevState as never,
currentVal: derived.state as never,
}
for (const listener of derived.listeners) {
listener(value)
}
}

@@ -148,5 +150,3 @@

if (__batchDepth === 0) {
const pendingUpdateToFlush = Array.from(__pendingUpdates)[0] as
| Store<unknown>
| undefined
const pendingUpdateToFlush = __pendingUpdates.values().next().value
if (pendingUpdateToFlush) {

@@ -153,0 +153,0 @@ __flush(pendingUpdateToFlush) // Trigger flush of all pending updates

@@ -15,4 +15,4 @@ /**

export interface ListenerValue<T> {
prevVal: T
currentVal: T
readonly prevVal: T
readonly currentVal: T
}

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

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

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

Sorry, the diff of this file is not supported yet