Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

(svelte) - Promise mutation result (#758)

authored by

Jovi De Croock and committed by
GitHub
944e8a23 670a3428

+9 -15
+5
.changeset/smart-adults-suffer.md
··· 1 + --- 2 + '@urql/svelte': patch 3 + --- 4 + 5 + Update `mutate` helper to return a Promise directly rather than a lazy Promise-like object.
+4 -15
packages/svelte-urql/src/operations/mutate.ts
··· 11 11 12 12 export const mutate = <T = any, V = object>( 13 13 args: MutationArguments<V> 14 - ): PromiseLike<OperationResult<T>> => { 15 - const client = getClient(); 16 - let promise: Promise<OperationResult<T>>; 17 - 18 - return { 19 - then(onValue) { 20 - if (!promise) { 21 - promise = client 22 - .mutation(args.query, args.variables as any, args.context) 23 - .toPromise(); 24 - } 25 - 26 - return promise.then(onValue); 27 - }, 28 - }; 14 + ): Promise<OperationResult<T>> => { 15 + return getClient() 16 + .mutation(args.query, args.variables as any, args.context) 17 + .toPromise(); 29 18 };