展示 HN:TanStack DB 的 IndexedDB 集合

1作者: raviatluri3 个月前原帖
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&#x27;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&#x27;ve been using this in my side projects — a Google Reader clone (<a href="https:&#x2F;&#x2F;github.com&#x2F;sonnes&#x2F;reader" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sonnes&#x2F;reader</a>) and a communication assistant for people with ALS&#x2F;MND (<a href="https:&#x2F;&#x2F;github.com&#x2F;sonnes&#x2F;september" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sonnes&#x2F;september</a>). I have opened a PR to the TanStack DB monorepo (<a href="https:&#x2F;&#x2F;github.com&#x2F;TanStack&#x2F;db&#x2F;pull&#x2F;1179" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;TanStack&#x2F;db&#x2F;pull&#x2F;1179</a>) and have also published as a standalone package.<p>npm: <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;indexeddb-collection" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;indexeddb-collection</a> GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;sonnes&#x2F;indexeddb-collection" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sonnes&#x2F;indexeddb-collection</a> PR: <a href="https:&#x2F;&#x2F;github.com&#x2F;TanStack&#x2F;db&#x2F;pull&#x2F;1179" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;TanStack&#x2F;db&#x2F;pull&#x2F;1179</a><p>Give it a try and let me know what you think.