Skip to content

Commit a04f2c1

Browse files
author
Guillaume Chau
committed
Merge branch 'v4' of github.com:Akryum/vue-apollo into v4
2 parents dbb1c09 + d86e6b7 commit a04f2c1

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
],
77
"private": true,
88
"scripts": {
9-
"build": "lerna run build --concurrency 1 --scope {vue-apollo,@vue/apollo}*",
9+
"build": "lerna run build --concurrency 1 --scope \"{vue-apollo,@vue/apollo}*\"",
1010
"test": "lerna run test --concurrency 1"
1111
},
1212
"devDependencies": {

packages/vue-apollo-composable/src/useApolloClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const ApolloClients = Symbol('apollo-clients')
77
export function useApolloClient<TCacheShape = any> (clientId: string = null) {
88
const providedApolloClients: { [key: string]: ApolloClient<TCacheShape> } = inject(ApolloClients, null)
99
const providedApolloClient: ApolloClient<TCacheShape> = inject(DefaultApolloClient, null)
10-
10+
1111
function resolveClient (clientId: string = null): ApolloClient<TCacheShape> {
1212
let resolvedClient
1313
if (clientId) {
@@ -35,4 +35,4 @@ export function useApolloClient<TCacheShape = any> (clientId: string = null) {
3535
return resolveClient(clientId)
3636
}
3737
}
38-
}
38+
}

packages/vue-apollo-composable/src/useMutation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function useMutation<
2727
trackMutation(loading)
2828
const error = ref<Error>(null)
2929
const called = ref<boolean>(false)
30-
30+
3131
const doneEvent = useEventHook<FetchResult<TResult, Record<string, any>, Record<string, any>>>()
3232
const errorEvent = useEventHook<Error>()
3333

@@ -85,4 +85,4 @@ export function useMutation<
8585
onDone: doneEvent.on,
8686
onError: errorEvent.on,
8787
}
88-
}
88+
}

packages/vue-apollo-composable/src/useResult.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { Ref, computed } from '@vue/composition-api'
22

33
export function useResult<
4+
TReturnValue = any,
5+
TDefaultValue = any,
46
TResult = any
57
> (
68
result: Ref<TResult>,
7-
defaultValue: any = null,
8-
pick: (data: TResult) => any = null,
9+
defaultValue: TDefaultValue = null,
10+
pick: (data: TResult) => TReturnValue = null,
911
) {
10-
return computed(() => {
12+
return computed<TDefaultValue | TReturnValue>(() => {
1113
const value = result.value
1214
if (value) {
1315
if (pick) {

0 commit comments

Comments
 (0)