YousefED / SyncedStore

SyncedStore CRDT is an easy-to-use library for building live, collaborative applications that sync automatically.
https://syncedstore.org
MIT License
1.71k stars 51 forks source link

Filter/query data store #75

Closed zzph closed 1 year ago

zzph commented 1 year ago

Hi there,

Firstly, this library is great.

Apologies if this is an obvious question- I’d like to filter the data before it’s sent to the store

For example, if I only wanted “completed” todos.

FWIW: I tired using “y-socket” to decode and then return filter but had no success. My thinking was to decode the entire store, then only send back specific data (or even indexes if a different data structure where data is in different “rooms” ie ws://…/key)

How I can filter the data before it arrives to the client? Can you offer any suggestions?

thanks

YousefED commented 1 year ago

Hi @zzph!

The way SyncedStore is designed, is that always the entire "store" is synced with others. This is the overall concept that SyncedStore wants to achieve; the ability to sync entire data stores in a "local first" way.

Depending on your use case, you can probably do what you want in a different way:

Hope this helps!