Open History to see the last commit
Breaking: grouping, includes, and pooling are now opt-in. An app bundles an operator's code only when it imports the value for that operator. Joins do not change. A typical app is about 8 kB smaller after gzip. This app has a query collection, a filtered live query, and React useLiveQuery.
- An include needs
include(),toArray(), ormaterialize(). Changeissues: q.from(...)inselect()toissues: include(q.from(...)). A subquery inselect()without one of these throwsIncludeOperatorRequiredError. - Aggregates such as
count()need no change. AgroupBywith no aggregate takesgroupKeys():.groupBy(groupKeys(({ todo }) => todo.status)). Without it, the query throwsGroupingOperatorRequiredError. - Hooks do not pool live queries by default. To share one partition among many equality-filtered queries, pass
pool: pooledLiveQueriesin the hook's query config:useLiveQuery({ query, pool: pooledLiveQueries }). Results do not change. Angular's{ params, query }form takespoolthe same way. Any otherpoolvalue, such as the old boolean, throwsInvalidPoolOptionError, also for a disabled query. For adapter authors: thepooloption ofresolveLiveQueryValueis nowpooledLiveQueriesorfalse, not a boolean. An adapter that readspoolfrom its own options checks it withconfigPoolfirst. - Code that builds query IR by hand must supply the operator code.
IR.AggregatetakesgroupingCompileras its third argument.IR.IncludesSubquerytakesincludesRuntimeas its fifth argument, beforeparentFilters. Import both from@tanstack/db. IR without them throwsGroupingOperatorRequiredErrororIncludeOperatorRequiredErrorwhen it compiles, unless another aggregate orgroupKeys()in the query supplies the grouping compiler. Queries that the query builder builds need no change. - Operator code is part of query identity. A hook that re-renders a grouped query without
groupKeys()now throwsGroupingOperatorRequiredError. Before, React and Preact kept the grouped query. - Vue: when a changed query fails to compile,
useLiveQueryno longer shows the rows of the previous query.