MCPcopy
hub / github.com/TanStack/query / tryResolveSync

Function tryResolveSync

packages/query-core/src/thenable.ts:94–111  ·  view source on GitHub ↗
(promise: Promise<unknown> | Thenable<unknown>)

Source from the content-addressed store, hash-verified

92 * should not be considered part of the public API.
93 */
94export function tryResolveSync(promise: Promise<unknown> | Thenable<unknown>) {
95 let data: unknown
96
97 promise
98 .then((result) => {
99 data = result
100 return result
101 }, noop)
102 // .catch can be unavailable on certain kinds of thenable's
103 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
104 ?.catch(noop)
105
106 if (data !== undefined) {
107 return { data }
108 }
109
110 return undefined
111}

Callers 1

hydrateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…