Conversation
🦋 Changeset detectedLatest commit: 914c31a The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
8c77252 to
b011fe2
Compare
- Make indexing explicit with BasicIndex and BTreeIndex - autoIndex defaults to 'off', dev mode suggestions warn when indexes would help - New @tanstack/db/indexing entry point for tree-shakeable indexing - BasicIndex: lightweight Map + sorted Array for equality and range queries - BTreeIndex: full-featured O(log n) index for large collections - Fix pagination when indexes aren't available - Remove docs folder (now CI-generated) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b011fe2 to
9c047aa
Compare
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: +1.85 kB (+1.99%) Total Size: 95 kB
ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 3.85 kB ℹ️ View Unchanged
|
Tests added on main were calling createIndex() or using autoIndex: 'eager' without setting defaultIndexType, which is now required. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR Review SummaryOverall this is a well-designed simplification. Replacing Critical
This is a deliberately-requested feature that silently degrades. Consider throwing if (config.autoIndex === 'eager' && !config.defaultIndexType) {
throw new CollectionConfigurationError(
`autoIndex: 'eager' requires defaultIndexType to be set. ` +
`Import an index type and set it:\n` +
` import { BasicIndex } from '@tanstack/db/indexing'\n` +
` createCollection({ defaultIndexType: BasicIndex, autoIndex: 'eager', ... })`
)
}Important
Suggestions
Test Coverage Gaps
Strengths
|
- Throw CollectionConfigurationError at construction when autoIndex: 'eager'
is used without defaultIndexType (was silently degrading in production)
- Use CollectionConfigurationError instead of generic Error in createIndex
- Wrap onSuggestion callback in try-catch to prevent buggy callbacks from
crashing query execution
- Clean up indexedKeys in BasicIndex.remove() catch block to prevent
phantom keys when expression evaluation fails
- Preserve original stack traces with { cause: error } in BasicIndex
- Update tests to provide defaultIndexType where needed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Test that autoIndex: 'eager' without defaultIndexType throws CollectionConfigurationError at construction time - Test that createIndex() without indexType or defaultIndexType throws CollectionConfigurationError Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Addressed review feedbackCritical
Important
Suggestions
Test coverage
Not addressed (needs discussion)
|
CI will regenerate these docs files after merge. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Index Tests added on main use autoIndex: 'eager' but didn't set defaultIndexType, which is now required after making indexing opt-in. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Makes indexing explicit and opt-in rather than automatic, allowing users to choose the right index type for their use case and enabling better tree-shaking.
Based on #950 with the
ReadOptimizedIndex/WriteOptimizedIndexrenaming reverted — keeps the originalBasicIndex/BTreeIndexnames.Key changes
autoIndexnow defaults tooffinstead ofeagerBTreeIndexis no longer exported from@tanstack/dbmain entry point@tanstack/db/indexingentry point for tree-shakeable indexingcreateIndex()orautoIndex: 'eager', you must setdefaultIndexTypeon the collectionBundle size impact
Test plan
defaultIndexTypewhere needed🤖 Generated with Claude Code