MCPcopy Create free account
hub / github.com/TanStack/query / addToStart

Function addToStart

packages/query-core/src/utils.ts:609–612  ·  view source on GitHub ↗
(items: Array<T>, item: T, max = 0)

Source from the content-addressed store, hash-verified

607 * @returns A new array with `item` added.
608 */
609export function addToStart<T>(items: Array<T>, item: T, max = 0): Array<T> {
610 const newItems = [item, ...items]
611 return max && newItems.length > max ? newItems.slice(0, max) : newItems
612}
613
614/**
615 * Sentinel value that can be passed as a query's `queryFn` to conditionally disable the query (equivalent

Callers 2

utils.test-d.tsxFile · 0.90
utils.test.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected