···11+---
22+'@urql/core': patch
33+---
44+55+Prevent stale results from being emitted by promisified query sources, e.g. `client.query(...).toPromise()` yielding a partial result with `stale: true` set. Instead, `.toPromise()` will now filter out stale results.
+13-5
packages/core/src/utils/streamUtils.ts
···11-import { Source, pipe, toPromise, take } from 'wonka';
11+import { Source, pipe, toPromise, filter, take } from 'wonka';
22+import { OperationResult, PromisifiedSource } from '../types';
2333-import { PromisifiedSource } from '../types';
44+export function withPromise<T extends OperationResult>(
55+ source$: Source<T>
66+): PromisifiedSource<T> {
77+ (source$ as PromisifiedSource<T>).toPromise = () => {
88+ return pipe(
99+ source$,
1010+ filter(result => !result.stale),
1111+ take(1),
1212+ toPromise
1313+ );
1414+ };
41555-export function withPromise<T>(source$: Source<T>): PromisifiedSource<T> {
66- (source$ as PromisifiedSource<T>).toPromise = () =>
77- pipe(source$, take(1), toPromise);
816 return source$ as PromisifiedSource<T>;
917}