GraphQLDependency.isEmptyArg() method
Reports whether a filter assembled for a loader has nothing left to look up, so the loader can be skipped.
Signature:
static isEmptyArg(filter: any): boolean;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
filter |
any |
the filter value to test |
Returns:
boolean
true when there is nothing left to fetch
Remarks
This is the test that keeps a query from making pointless round trips: once the ids already in the request's resolution cache have been removed from a filter, what remains may be nothing at all, and the dependency is then satisfied from the cache instead of by a call.
"Empty" is looser than falsy, and worth knowing precisely if you write your own filters. An array is empty when it has no elements. A plain object is empty when every one of its own properties is either falsy or an empty array — so {} and { ids: [] } both count as empty, while { ids: [1] } does not. Anything else is empty when it is falsy.
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.