Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Dec 14, 2025

This PR contains the following updates:

Package Change Age Confidence
@tanstack/query-db-collection (source) 1.0.5 -> 1.0.8 age confidence

Release Notes

TanStack/db (@​tanstack/query-db-collection)

v1.0.8

Compare Source

Patch Changes
  • Fix writeInsert/writeUpsert throwing error when collection uses select option (#​1023)

    When a Query Collection was configured with a select option to extract items from a wrapped API response (e.g., { data: [...], meta: {...} }), calling writeInsert() or writeUpsert() would corrupt the query cache and trigger the error: "select() must return an array of objects".

    The fix routes cache updates through a new updateCacheData function that preserves the wrapper structure by using the select function to identify which property contains the items array (via reference equality), then updates only that property while keeping metadata intact.

v1.0.7

Compare Source

Patch Changes
  • Enhanced LoadSubsetOptions with separate cursor expressions and offset for flexible pagination. (#​960)

    ⚠️ Breaking Change for Custom Sync Layers / Query Collections:

    LoadSubsetOptions.where no longer includes cursor expressions for pagination. If you have a custom sync layer or query collection that implements loadSubset, you must now handle pagination separately:

    • Cursor-based pagination: Use the new cursor property (cursor.whereFrom and cursor.whereCurrent) and combine them with where yourself
    • Offset-based pagination: Use the new offset property

    Previously, cursor expressions were baked into the where clause. Now they are passed separately so sync layers can choose their preferred pagination strategy.

    Changes:

    • Added CursorExpressions type with whereFrom, whereCurrent, and optional lastKey properties
    • Added cursor to LoadSubsetOptions for cursor-based pagination (separate from where)
    • Added offset to LoadSubsetOptions for offset-based pagination support
    • Electric sync layer now makes two parallel requestSnapshot calls when cursor is present:
      • One for whereCurrent (all ties at boundary, no limit)
      • One for whereFrom (rows after cursor, with limit)
    • Query collection serialization now includes offset for query key generation
    • Added truncate event to collections, emitted when synced data is truncated (e.g., after must-refetch)
    • Fixed setWindow pagination: cursor expressions are now correctly built when paging through results
    • Fixed offset tracking: loadNextItems now passes the correct window offset to prevent incorrect deduplication
    • CollectionSubscriber now listens for truncate events to reset cursor tracking state

    Benefits:

    • Sync layers can choose between cursor-based or offset-based pagination strategies
    • Electric can efficiently handle tie-breaking with two targeted requests
    • Better separation of concerns between filtering (where) and pagination (cursor/offset)
    • setWindow correctly triggers backend loading for subsequent pages in multi-column orderBy queries
    • Cursor state is properly reset after truncation, preventing stale cursor data from being used
  • Updated dependencies [b3b1940, 09da081, 86ad40c]:

v1.0.6

Compare Source

Patch Changes
  • fix(query-db-collection): use deep equality for object field comparison in query observer (#​967)

    Fixed an issue where updating object fields (non-primitives) with refetch: false in onUpdate handlers would cause the value to rollback to the previous state every other update. The query observer was using shallow equality (===) to compare items, which compares object properties by reference rather than by value. This caused the observer to incorrectly detect differences and write stale data back to syncedData. Now uses deepEquals for proper value comparison.

  • Use regular dependency for @​tanstack/db instead of peerDependency to match the standard pattern used by other TanStack DB packages and prevent duplicate installations (#​952)

  • Updated dependencies [c4b9399, a1a484e]:


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot enabled auto-merge December 14, 2025 00:55
@renovate renovate bot force-pushed the renovate/tanstack-query-db-collection-1.x-lockfile branch 2 times, most recently from f9d0e04 to e6bd4d6 Compare December 16, 2025 02:24
@renovate renovate bot force-pushed the renovate/tanstack-query-db-collection-1.x-lockfile branch from e6bd4d6 to 1c2b092 Compare December 19, 2025 17:07
@renovate renovate bot changed the title Update dependency @tanstack/query-db-collection to v1.0.6 Update dependency @tanstack/query-db-collection to v1.0.7 Dec 19, 2025
@renovate renovate bot changed the title Update dependency @tanstack/query-db-collection to v1.0.7 Update dependency @tanstack/query-db-collection to v1.0.8 Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant