cvara / rxdb-hooks

React hooks for integrating with RxDB
MIT License
132 stars 5 forks source link

useRxData doesn't support findByIds #46

Closed nirvdrum closed 2 years ago

nirvdrum commented 2 years ago

I'm trying to query for a set of IDs with a query supplied to useRxData. Unfortunately, it doesn't seem to work. The type definitions don't appear to be compatible, as findByIds returns a Map<string, doc_type>. Thinking maybe the type definitions just needed to be updated, I typed the query constructor instance as any, but that didn't help. The query never resolves and isFetching is always true.

cvara commented 2 years ago

It seems that findOne() is the single exception among RxCollection query functions that exposes a promise-based API, so it can't be used with useRxData which naturally expects a query object with a BehaviorSubject $ attached to it.

I will try to work on a patch for this soon.

cvara commented 2 years ago

Fixed in 4.0.2.