Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
45 changes: 0 additions & 45 deletions .changeset/fast-localstorage-mutations.md

This file was deleted.

8 changes: 8 additions & 0 deletions examples/react/paced-mutations-demo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @tanstack/db-example-paced-mutations-demo

## 0.0.6

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19
- @tanstack/react-db@0.1.42

## 0.0.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/react/paced-mutations-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/db-example-paced-mutations-demo",
"version": "0.0.5",
"version": "0.0.6",
"private": true,
"type": "module",
"scripts": {
Expand Down
10 changes: 10 additions & 0 deletions examples/react/todo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# examples/react/todo

## 0.1.22

### Patch Changes

- Updated dependencies []:
- @tanstack/electric-db-collection@0.1.43
- @tanstack/query-db-collection@0.2.42
- @tanstack/react-db@0.1.42
- @tanstack/trailbase-db-collection@0.1.41

## 0.1.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/react/todo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/db-example-react-todo",
"private": true,
"version": "0.1.21",
"version": "0.1.22",
"dependencies": {
"@tanstack/electric-db-collection": "workspace:^",
"@tanstack/query-core": "^5.90.5",
Expand Down
7 changes: 7 additions & 0 deletions packages/angular-db/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/angular-db

## 0.1.24

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19

## 0.1.23

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-db/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/angular-db",
"description": "Angular integration for @tanstack/db",
"version": "0.1.23",
"version": "0.1.24",
"author": "Ethan McDaniel",
"license": "MIT",
"repository": {
Expand Down
40 changes: 40 additions & 0 deletions packages/db/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# @tanstack/db

## 0.4.19

### Patch Changes

- Significantly improve localStorage collection performance during rapid mutations ([#760](https://github.com/TanStack/db/pull/760))

Optimizes localStorage collections to eliminate redundant storage reads, providing dramatic performance improvements for use cases with rapid mutations (e.g., text input with live query rendering).

**Performance Improvements:**
- **67% reduction in localStorage I/O operations** - from 3 reads + 1 write per mutation down to just 1 write
- Eliminated 2 JSON parse operations per mutation
- Eliminated 1 full collection diff operation per mutation
- Leverages in-memory cache (`lastKnownData`) instead of reading from storage on every mutation

**What Changed:**
1. **Mutation handlers** now use in-memory cache instead of loading from storage before mutations
2. **Post-mutation sync** eliminated - no longer triggers redundant storage reads after local mutations
3. **Manual transactions** (`acceptMutations`) optimized to use in-memory cache

**Before:** Each mutation performed 3 I/O operations:
- `loadFromStorage()` - read + JSON parse
- Modify data
- `saveToStorage()` - JSON stringify + write
- `processStorageChanges()` - another read + parse + diff

**After:** Each mutation performs 1 I/O operation:
- Modify in-memory data ✨ No I/O!
- `saveToStorage()` - JSON stringify + write

**Safety:**
- Cross-tab synchronization still works correctly via storage event listeners
- All 50 tests pass including 8 new tests specifically for rapid mutations and edge cases
- 92.3% code coverage on local-storage.ts
- `lastKnownData` cache kept in sync with storage through initial load, mutations, and cross-tab events

This optimization is particularly impactful for applications with:
- Real-time text input with live query rendering
- Frequent mutations to localStorage-backed collections
- Multiple rapid sequential mutations

## 0.4.18

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/db/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/db",
"description": "A reactive client store for building super fast apps on sync",
"version": "0.4.18",
"version": "0.4.19",
"dependencies": {
"@standard-schema/spec": "^1.0.0",
"@tanstack/db-ivm": "workspace:*",
Expand Down
7 changes: 7 additions & 0 deletions packages/electric-db-collection/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/electric-db-collection

## 0.1.43

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19

## 0.1.42

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/electric-db-collection/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/electric-db-collection",
"description": "ElectricSQL collection for TanStack DB",
"version": "0.1.42",
"version": "0.1.43",
"dependencies": {
"@electric-sql/client": "^1.1.0",
"@standard-schema/spec": "^1.0.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/offline-transactions/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/offline-transactions

## 0.1.2

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19

## 0.1.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/offline-transactions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tanstack/offline-transactions",
"version": "0.1.1",
"version": "0.1.2",
"description": "Offline-first transaction capabilities for TanStack DB",
"author": "TanStack",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/powersync-db-collection/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/powersync-db-collection

## 0.1.2

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19

## 0.1.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/powersync-db-collection/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/powersync-db-collection",
"description": "PowerSync collection for TanStack DB",
"version": "0.1.1",
"version": "0.1.2",
"dependencies": {
"@standard-schema/spec": "^1.0.0",
"@tanstack/db": "workspace:*",
Expand Down
7 changes: 7 additions & 0 deletions packages/query-db-collection/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/query-db-collection

## 0.2.42

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19

## 0.2.41

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/query-db-collection/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/query-db-collection",
"description": "TanStack Query collection for TanStack DB",
"version": "0.2.41",
"version": "0.2.42",
"dependencies": {
"@standard-schema/spec": "^1.0.0",
"@tanstack/db": "workspace:*"
Expand Down
7 changes: 7 additions & 0 deletions packages/react-db/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/react-db

## 0.1.42

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19

## 0.1.41

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react-db/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/react-db",
"description": "React integration for @tanstack/db",
"version": "0.1.41",
"version": "0.1.42",
"author": "Kyle Mathews",
"license": "MIT",
"repository": {
Expand Down
7 changes: 7 additions & 0 deletions packages/rxdb-db-collection/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/rxdb-db-collection

## 0.1.30

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19

## 0.1.29

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/rxdb-db-collection/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/rxdb-db-collection",
"description": "RxDB collection for TanStack DB",
"version": "0.1.29",
"version": "0.1.30",
"dependencies": {
"rxdb": "16.20.0",
"@standard-schema/spec": "^1.0.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/solid-db/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/react-db

## 0.1.41

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19

## 0.1.40

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/solid-db/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/solid-db",
"description": "Solid integration for @tanstack/db",
"version": "0.1.40",
"version": "0.1.41",
"author": "Kyle Mathews",
"license": "MIT",
"repository": {
Expand Down
7 changes: 7 additions & 0 deletions packages/svelte-db/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/svelte-db

## 0.1.41

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19

## 0.1.40

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-db/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/svelte-db",
"description": "Svelte integration for @tanstack/db",
"version": "0.1.40",
"version": "0.1.41",
"dependencies": {
"@tanstack/db": "workspace:*"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/trailbase-db-collection/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/trailbase-db-collection

## 0.1.41

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19

## 0.1.40

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/trailbase-db-collection/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/trailbase-db-collection",
"description": "TrailBase collection for TanStack DB",
"version": "0.1.40",
"version": "0.1.41",
"dependencies": {
"@standard-schema/spec": "^1.0.0",
"@tanstack/db": "workspace:*",
Expand Down
7 changes: 7 additions & 0 deletions packages/vue-db/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @tanstack/vue-db

## 0.0.74

### Patch Changes

- Updated dependencies [[`75470a8`](https://github.com/TanStack/db/commit/75470a8297f316b4817601b2ea92cb9b21cc7829)]:
- @tanstack/db@0.4.19

## 0.0.73

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-db/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tanstack/vue-db",
"description": "Vue integration for @tanstack/db",
"version": "0.0.73",
"version": "0.0.74",
"author": "Kyle Mathews",
"license": "MIT",
"repository": {
Expand Down