Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pipe(
subscription$,
map(({ stale, data, error, extensions }) => ({
fetching: true,
stale: !!stale,
data,
error,
extensions,
}))
),
// When the source proactively closes, fetching is set to false
fromValue({ fetching: false }),
]);
}),
// The individual partial results are merged into each previous result
scan((result, partial: any) => {
const { current: handler } = handlerRef;
// If a handler has been passed, it's used to merge new data in
const data =
partial.data !== undefined
? typeof handler === 'function'
? handler(result.data, partial.data)
: partial.data
: result.data;
return { ...result, stale: false, ...partial, data };
}, initialState)
),
useMemo(() => (args.pause ? null : makeSubscription$()), [
pipe(
query$,
map(({ stale, data, error, extensions }) => ({
fetching: false,
stale: !!stale,
data,
error,
extensions,
}))
),
// When the source proactively closes, fetching is set to false
fromValue({ fetching: false }),
]);
}),
// The individual partial results are merged into each previous result
scan(
(result, partial) => ({ ...result, stale: false, ...partial }),
initialState
)
),
useMemo(() => (args.pause ? null : makeQuery$()), [args.pause, makeQuery$]),