MCPcopy Index your code
hub / github.com/TanStack/db / optimizeNestedFrom

Function optimizeNestedFrom

packages/db/src/query/optimizer.ts:883–901  ·  view source on GitHub ↗
(from: From)

Source from the content-addressed store, hash-verified

881}
882
883function optimizeNestedFrom(from: From): From {
884 if (from.type === `queryRef`) {
885 return new QueryRefClass(applyRecursiveOptimization(from.query), from.alias)
886 }
887
888 if (from.type === `unionFrom`) {
889 return new UnionFromClass(
890 from.sources.map((source) => optimizeNestedFrom(source) as any),
891 )
892 }
893
894 if (from.type === `unionAll`) {
895 return new UnionAllClass(
896 from.queries.map((branch) => applyRecursiveOptimization(branch)),
897 )
898 }
899
900 return from
901}
902
903function getFromSources(from: From): Array<CollectionRefClass | QueryRefClass> {
904 if (from.type === `unionFrom`) {

Callers 1

Calls 2

mapMethod · 0.45

Tested by

no test coverage detected