展示 HN:TanStack DB 的 IndexedDB 集合
Claude和我为TanStack DB构建了一个基于IndexedDB的集合适配器,提供持久的本地存储,并支持自动跨标签页同步。
我非常喜欢TanStack DB库,但它只支持内存和localStorage集合。我需要一个能够处理更大数据集并支持标签页间同步的解决方案,因此我让Claude来实现这个功能。
我在我的一些副项目中使用了这个适配器——一个Google Reader克隆([https://github.com/sonnes/reader](https://github.com/sonnes/reader))和一个为ALS/MND患者设计的沟通助手([https://github.com/sonnes/september](https://github.com/sonnes/september))。我已经向TanStack DB的单一代码库提交了一个PR([https://github.com/TanStack/db/pull/1179](https://github.com/TanStack/db/pull/1179)),并且也将其发布为一个独立的包。
npm: [https://www.npmjs.com/package/indexeddb-collection](https://www.npmjs.com/package/indexeddb-collection)
GitHub: [https://github.com/sonnes/indexeddb-collection](https://github.com/sonnes/indexeddb-collection)
PR: [https://github.com/TanStack/db/pull/1179](https://github.com/TanStack/db/pull/1179)
试试看,告诉我你的想法。
查看原文
Claude and I built an IndexedDB-backed collection adapter for TanStack DB that provides persistent local storage, with automatic cross-tab synchronization.<p>I'm a big fan of TanStack DB library but it only had in-memory and localStorage collections. I needed something that could handle larger datasets, and sync across tabs — soI got Claude to build this.<p>I've been using this in my side projects — a Google Reader clone (<a href="https://github.com/sonnes/reader" rel="nofollow">https://github.com/sonnes/reader</a>) and a communication assistant for people with ALS/MND (<a href="https://github.com/sonnes/september" rel="nofollow">https://github.com/sonnes/september</a>). I have opened a PR to the TanStack DB monorepo (<a href="https://github.com/TanStack/db/pull/1179" rel="nofollow">https://github.com/TanStack/db/pull/1179</a>) and have also published as a standalone package.<p>npm: <a href="https://www.npmjs.com/package/indexeddb-collection" rel="nofollow">https://www.npmjs.com/package/indexeddb-collection</a>
GitHub: <a href="https://github.com/sonnes/indexeddb-collection" rel="nofollow">https://github.com/sonnes/indexeddb-collection</a>
PR: <a href="https://github.com/TanStack/db/pull/1179" rel="nofollow">https://github.com/TanStack/db/pull/1179</a><p>Give it a try and let me know what you think.