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
5 changes: 0 additions & 5 deletions .changeset/dark-items-dig.md

This file was deleted.

69 changes: 0 additions & 69 deletions .changeset/offline-transactions-initial.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.3

### Patch Changes

- Updated dependencies [[`49bcaa5`](https://github.com/TanStack/db/commit/49bcaa5557ba8d647c947811ed6e0c2450159d84)]:
- @tanstack/db@0.4.17
- @tanstack/react-db@0.1.39

## 0.0.2

### 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.2",
"version": "0.0.3",
"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.19

### Patch Changes

- Updated dependencies []:
- @tanstack/electric-db-collection@0.1.41
- @tanstack/query-db-collection@0.2.40
- @tanstack/react-db@0.1.39
- @tanstack/trailbase-db-collection@0.1.39

## 0.1.18

### 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.18",
"version": "0.1.19",
"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.22

### Patch Changes

- Updated dependencies [[`49bcaa5`](https://github.com/TanStack/db/commit/49bcaa5557ba8d647c947811ed6e0c2450159d84)]:
- @tanstack/db@0.4.17

## 0.1.21

### 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.21",
"version": "0.1.22",
"author": "Ethan McDaniel",
"license": "MIT",
"repository": {
Expand Down
65 changes: 65 additions & 0 deletions packages/db/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,70 @@
# @tanstack/db

## 0.4.17

### Patch Changes

- Add offline-transactions package with robust offline-first capabilities ([#559](https://github.com/TanStack/db/pull/559))

New package `@tanstack/offline-transactions` provides a comprehensive offline-first transaction system with:

**Core Features:**
- Persistent outbox pattern for reliable transaction processing
- Leader election for multi-tab coordination (Web Locks API with BroadcastChannel fallback)
- Automatic storage capability detection with graceful degradation
- Retry logic with exponential backoff and jitter
- Sequential transaction processing (FIFO ordering)

**Storage:**
- Automatic fallback chain: IndexedDB → localStorage → online-only
- Detects and handles private mode, SecurityError, QuotaExceededError
- Custom storage adapter support
- Diagnostic callbacks for storage failures

**Developer Experience:**
- TypeScript-first with full type safety
- Comprehensive test suite (25 tests covering leader failover, storage failures, e2e scenarios)
- Works in all modern browsers and server-side rendering environments

**@tanstack/db improvements:**
- Enhanced duplicate instance detection (dev-only, iframe-aware, with escape hatch)
- Better environment detection for SSR and worker contexts

Example usage:

```typescript
import {
startOfflineExecutor,
IndexedDBAdapter,
} from "@tanstack/offline-transactions"

const executor = startOfflineExecutor({
collections: { todos: todoCollection },
storage: new IndexedDBAdapter(),
mutationFns: {
syncTodos: async ({ transaction, idempotencyKey }) => {
// Sync mutations to backend
await api.sync(transaction.mutations, idempotencyKey)
},
},
onStorageFailure: (diagnostic) => {
console.warn("Running in online-only mode:", diagnostic.message)
},
})

// Create offline transaction
const tx = executor.createOfflineTransaction({
mutationFnName: "syncTodos",
autoCommit: false,
})

tx.mutate(() => {
todoCollection.insert({ id: "1", text: "Buy milk", completed: false })
})

await tx.commit() // Persists to outbox and syncs when online
```

## 0.4.16

### 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.16",
"version": "0.4.17",
"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.41

### Patch Changes

- Updated dependencies [[`49bcaa5`](https://github.com/TanStack/db/commit/49bcaa5557ba8d647c947811ed6e0c2450159d84)]:
- @tanstack/db@0.4.17

## 0.1.40

### 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.40",
"version": "0.1.41",
"dependencies": {
"@electric-sql/client": "^1.1.0",
"@standard-schema/spec": "^1.0.0",
Expand Down
71 changes: 71 additions & 0 deletions packages/offline-transactions/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# @tanstack/offline-transactions

## 0.1.0

### Minor Changes

- Add offline-transactions package with robust offline-first capabilities ([#559](https://github.com/TanStack/db/pull/559))

New package `@tanstack/offline-transactions` provides a comprehensive offline-first transaction system with:

**Core Features:**
- Persistent outbox pattern for reliable transaction processing
- Leader election for multi-tab coordination (Web Locks API with BroadcastChannel fallback)
- Automatic storage capability detection with graceful degradation
- Retry logic with exponential backoff and jitter
- Sequential transaction processing (FIFO ordering)

**Storage:**
- Automatic fallback chain: IndexedDB → localStorage → online-only
- Detects and handles private mode, SecurityError, QuotaExceededError
- Custom storage adapter support
- Diagnostic callbacks for storage failures

**Developer Experience:**
- TypeScript-first with full type safety
- Comprehensive test suite (25 tests covering leader failover, storage failures, e2e scenarios)
- Works in all modern browsers and server-side rendering environments

**@tanstack/db improvements:**
- Enhanced duplicate instance detection (dev-only, iframe-aware, with escape hatch)
- Better environment detection for SSR and worker contexts

Example usage:

```typescript
import {
startOfflineExecutor,
IndexedDBAdapter,
} from "@tanstack/offline-transactions"

const executor = startOfflineExecutor({
collections: { todos: todoCollection },
storage: new IndexedDBAdapter(),
mutationFns: {
syncTodos: async ({ transaction, idempotencyKey }) => {
// Sync mutations to backend
await api.sync(transaction.mutations, idempotencyKey)
},
},
onStorageFailure: (diagnostic) => {
console.warn("Running in online-only mode:", diagnostic.message)
},
})

// Create offline transaction
const tx = executor.createOfflineTransaction({
mutationFnName: "syncTodos",
autoCommit: false,
})

tx.mutate(() => {
todoCollection.insert({ id: "1", text: "Buy milk", completed: false })
})

await tx.commit() // Persists to outbox and syncs when online
```

### Patch Changes

- Updated dependencies [[`49bcaa5`](https://github.com/TanStack/db/commit/49bcaa5557ba8d647c947811ed6e0c2450159d84)]:
- @tanstack/db@0.4.17
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.0.0",
"version": "0.1.0",
"description": "Offline-first transaction capabilities for TanStack DB",
"author": "TanStack",
"license": "MIT",
Expand Down
11 changes: 11 additions & 0 deletions packages/powersync-db-collection/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# @tanstack/powersync-db-collection

## 0.1.0

### Minor Changes

- Initial Release ([#747](https://github.com/TanStack/db/pull/747))

### Patch Changes

- Updated dependencies [[`49bcaa5`](https://github.com/TanStack/db/commit/49bcaa5557ba8d647c947811ed6e0c2450159d84)]:
- @tanstack/db@0.4.17
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.0.0",
"version": "0.1.0",
"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.40

### Patch Changes

- Updated dependencies [[`49bcaa5`](https://github.com/TanStack/db/commit/49bcaa5557ba8d647c947811ed6e0c2450159d84)]:
- @tanstack/db@0.4.17

## 0.2.39

### 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.39",
"version": "0.2.40",
"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.39

### Patch Changes

- Updated dependencies [[`49bcaa5`](https://github.com/TanStack/db/commit/49bcaa5557ba8d647c947811ed6e0c2450159d84)]:
- @tanstack/db@0.4.17

## 0.1.38

### 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.38",
"version": "0.1.39",
"author": "Kyle Mathews",
"license": "MIT",
"repository": {
Expand Down
Loading