Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6f26046
feat(core): add evaluate util
harry-whorlow Apr 26, 2026
5c9612a
chore: pr comment
harry-whorlow Apr 27, 2026
b436a80
ci: apply automated fixes and generate docs
autofix-ci[bot] Apr 27, 2026
31a570c
chore: protect against mixed inputs
harry-whorlow Apr 27, 2026
0fe9052
ci: apply automated fixes and generate docs
autofix-ci[bot] Apr 27, 2026
50628e1
chore: split mode
harry-whorlow Apr 28, 2026
194eab9
fix: circular references
harry-whorlow Apr 28, 2026
2c9d221
ci: apply automated fixes and generate docs
autofix-ci[bot] Apr 28, 2026
a5d59a1
fix: symbol keys eval
harry-whorlow Apr 28, 2026
14efb5e
fix: unstub cleanup
harry-whorlow Apr 28, 2026
4c5120f
chore: update tests
harry-whorlow Apr 28, 2026
06f8762
ci: apply automated fixes and generate docs
autofix-ci[bot] Apr 28, 2026
6352e9c
fix: file test
harry-whorlow Apr 28, 2026
ee3609e
ci: apply automated fixes and generate docs
autofix-ci[bot] Apr 28, 2026
fe24280
chore: rename
harry-whorlow Apr 28, 2026
913bf8e
fix: subclass instances
harry-whorlow Apr 28, 2026
71b2aa0
ci: apply automated fixes and generate docs
autofix-ci[bot] Apr 28, 2026
f788666
Merge branch 'main' into evaluate
KevinVandy Jun 18, 2026
29d88b6
Merge remote-tracking branch 'origin/main' into evaluate
harry-whorlow Aug 12, 2026
1ac124e
Merge branch 'main' into evaluate
harry-whorlow Oct 6, 2026
d00d4bf
ci: apply automated fixes and generate docs
autofix-ci[bot] Oct 6, 2026
85658a4
chore: evaluate temporal
harry-whorlow Oct 6, 2026
85b3a1e
chore: split to imperative functions
harry-whorlow Oct 6, 2026
2f4c232
fix: bump node to 26
harry-whorlow Oct 6, 2026
2151a8c
ci: apply automated fixes and generate docs
autofix-ci[bot] Oct 6, 2026
aca5f83
fix: temporal types
harry-whorlow Oct 6, 2026
bb4f118
ci: apply automated fixes and generate docs
autofix-ci[bot] Oct 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24.8.0
26.10.0
30 changes: 30 additions & 0 deletions docs/reference/functions/compareDeep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
id: compareDeep
title: compareDeep
---

```ts
function compareDeep<T>(objA, objB): boolean;
```

Defined in: [compare.ts:5](https://github.com/TanStack/store/blob/main/packages/store/src/compare.ts#L5)

## Type Parameters

### T

`T`

## Parameters

### objA

`T`

### objB

`T`

## Returns

`boolean`
30 changes: 30 additions & 0 deletions docs/reference/functions/compareShallow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
id: compareShallow
title: compareShallow
---

```ts
function compareShallow<T>(objA, objB): boolean;
```

Defined in: [compare.ts:1](https://github.com/TanStack/store/blob/main/packages/store/src/compare.ts#L1)

## Type Parameters

### T

`T`

## Parameters

### objA

`T`

### objB

`T`

## Returns

`boolean`
2 changes: 2 additions & 0 deletions docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ title: "@tanstack/store"
## Functions

- [batch](functions/batch.md)
- [compareDeep](functions/compareDeep.md)
- [compareShallow](functions/compareShallow.md)
- [createAsyncAtom](functions/createAsyncAtom.md)
- [createAtom](functions/createAtom.md)
- [createStore](functions/createStore.md)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@tanstack/typedoc-config": "0.3.3",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/user-event": "^14.6.1",
"@types/node": "^25.6.0",
"@types/node": "^26.6.0",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to split this into a new pr

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lmk when you do and we can get this one in

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidkpiano its already done its living over in the pr

"@vitest/coverage-istanbul": "^4.1.4",
"eslint": "^10.2.0",
"eslint-plugin-react-hooks": "^7.0.1",
Expand Down
24 changes: 12 additions & 12 deletions packages/react-store/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { describe, expect, it, test, vi } from 'vitest'
import { createAtom, createStore } from '@tanstack/store'
import {
_useStore,
compareShallow,
createStoreContext,
shallow,
useAtom,
useCreateAtom,
useCreateStore,
Expand Down Expand Up @@ -748,66 +748,66 @@ describe('shallow', () => {
test('should return true for shallowly equal objects', () => {
const objA = { a: 1, b: 'hello' }
const objB = { a: 1, b: 'hello' }
expect(shallow(objA, objB)).toBe(true)
expect(compareShallow(objA, objB)).toBe(true)
})

test('should return false for objects with different values', () => {
const objA = { a: 1, b: 'hello' }
const objB = { a: 2, b: 'world' }
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return false for objects with different keys', () => {
const objA = { a: 1, b: 'hello' }
const objB = { a: 1, c: 'world' }
// @ts-expect-error
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return false for objects with different structures', () => {
const objA = { a: 1, b: 'hello' }
const objB = [1, 'hello']
// @ts-expect-error
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return false for one object being null', () => {
const objA = { a: 1, b: 'hello' }
const objB = null
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return false for one object being undefined', () => {
const objA = { a: 1, b: 'hello' }
const objB = undefined
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return true for two null objects', () => {
const objA = null
const objB = null
expect(shallow(objA, objB)).toBe(true)
expect(compareShallow(objA, objB)).toBe(true)
})

test('should return false for objects with different types', () => {
const objA = { a: 1, b: 'hello' }
const objB = { a: '1', b: 'hello' }
// @ts-expect-error
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return true for shallow equal objects with symbol keys', () => {
const sym = Symbol.for('key')
const objA = { [sym]: 1 }
const objB = { [sym]: 1 }
expect(shallow(objA, objB)).toBe(true)
expect(compareShallow(objA, objB)).toBe(true)
})

test('should return false for shallow different values for symbol keys', () => {
const sym = Symbol.for('key')
const objA = { [sym]: 1 }
const objB = { [sym]: 2 }
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return true for non-enumerable keys', () => {
Expand All @@ -824,7 +824,7 @@ describe('shallow', () => {
value: 2,
})

expect(shallow(objA, objB)).toBe(true)
expect(compareShallow(objA, objB)).toBe(true)
})

test('should handle arrays inside of a useSelector', async () => {
Expand Down
34 changes: 17 additions & 17 deletions packages/solid-store/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { render, renderHook } from '@solidjs/testing-library'
import { createAtom, createStore } from '@tanstack/store'
import {
_useStore,
compareShallow,
createStoreContext,
shallow,
useAtom,
useSelector,
useStore,
Expand Down Expand Up @@ -263,101 +263,101 @@ describe('shallow', () => {
test('should return true for shallowly equal objects', () => {
const objA = { a: 1, b: 'hello' }
const objB = { a: 1, b: 'hello' }
expect(shallow(objA, objB)).toBe(true)
expect(compareShallow(objA, objB)).toBe(true)
})

test('should return false for objects with different values', () => {
const objA = { a: 1, b: 'hello' }
const objB = { a: 2, b: 'world' }
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return false for objects with different keys', () => {
const objA = { a: 1, b: 'hello' }
const objB = { a: 1, c: 'world' }
// @ts-expect-error
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return false for objects with different structures', () => {
const objA = { a: 1, b: 'hello' }
const objB = [1, 'hello']
// @ts-expect-error
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return false for one object being null', () => {
const objA = { a: 1, b: 'hello' }
const objB = null
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return false for one object being undefined', () => {
const objA = { a: 1, b: 'hello' }
const objB = undefined
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return true for two null objects', () => {
const objA = null
const objB = null
expect(shallow(objA, objB)).toBe(true)
expect(compareShallow(objA, objB)).toBe(true)
})

test('should return false for objects with different types', () => {
const objA = { a: 1, b: 'hello' }
const objB = { a: '1', b: 'hello' }
// @ts-expect-error
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return true for shallow equal objects with symbol keys', () => {
const sym = Symbol.for('key')
const objA = { [sym]: 1 }
const objB = { [sym]: 1 }
expect(shallow(objA, objB)).toBe(true)
expect(compareShallow(objA, objB)).toBe(true)
})

test('should return false for shallow different values for symbol keys', () => {
const sym = Symbol.for('key')
const objA = { [sym]: 1 }
const objB = { [sym]: 2 }
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return true for shallowly equal maps', () => {
const objA = new Map([['1', 'hello']])
const objB = new Map([['1', 'hello']])
expect(shallow(objA, objB)).toBe(true)
expect(compareShallow(objA, objB)).toBe(true)
})

test('should return false for maps with different values', () => {
const objA = new Map([['1', 'hello']])
const objB = new Map([['1', 'world']])
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return true for shallowly equal sets', () => {
const objA = new Set([1])
const objB = new Set([1])
expect(shallow(objA, objB)).toBe(true)
expect(compareShallow(objA, objB)).toBe(true)
})

test('should return false for sets with different values', () => {
const objA = new Set([1])
const objB = new Set([2])
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return false for dates with different values', () => {
const objA = new Date('2025-04-10T14:48:00')
const objB = new Date('2025-04-10T14:58:00')
expect(shallow(objA, objB)).toBe(false)
expect(compareShallow(objA, objB)).toBe(false)
})

test('should return true for equal dates', () => {
const objA = new Date('2025-02-10')
const objB = new Date('2025-02-10')
expect(shallow(objA, objB)).toBe(true)
expect(compareShallow(objA, objB)).toBe(true)
})
})
Loading
Loading