Query Signals
Query signals in TeamPlay represent the result of a query on a collection. They are created using the sub() function or useSub() hook with query parameters.
Creating a Query Signal
Properties and Methods
ids
A signal containing an array of IDs for the documents in the query result.
map(callback)
Maps over the documents in the query result.
reduce(callback, initialValue)
Reduces the documents in the query result to a single value.
find(predicate)
Finds the first document in the query result that satisfies the predicate.
Iteration
Query signals are iterable, allowing you to use them in for...of loops:
Notes
- Query signals are reactive. Changes to the underlying data or to the query result will automatically update components using the query signal.
- The documents within a query signal are themselves signals, allowing for nested reactivity.