diff --git a/query/src/lib/operators.ts b/query/src/lib/operators.ts index 72ba9bb..d4af75e 100644 --- a/query/src/lib/operators.ts +++ b/query/src/lib/operators.ts @@ -148,6 +148,7 @@ export function intersectResults$< return map((values) => { const isArray = Array.isArray(values); const toArray = isArray ? values : Object.values(values); + const refetch = () => Promise.all(toArray.map(v => v.refetch())); const mappedResult = { all: values, @@ -158,6 +159,7 @@ export function intersectResults$< isFetching: toArray.some((v) => v.isFetching), error: toArray.find((v) => v.isError)?.error, data: undefined, + refetch, } as unknown as QueryObserverResult & { all: T }; if (mappedResult.isSuccess) { diff --git a/query/src/lib/signals.ts b/query/src/lib/signals.ts index 57f127a..3412177 100644 --- a/query/src/lib/signals.ts +++ b/query/src/lib/signals.ts @@ -59,10 +59,11 @@ export function intersectResults< signals: T, mapFn: (values: UnifiedTypes) => R, ): Signal & { all: T }> { - return computed(() => { - const isArray = Array.isArray(signals); - const toArray = isArray ? signals : Object.values(signals); + const isArray = Array.isArray(signals); + const toArray = isArray ? signals : Object.values(signals); + const refetch = () => Promise.all(toArray.map(v => v().refetch())); + return computed(() => { const mappedResult = { all: signals, isSuccess: toArray.every((v) => v().isSuccess), @@ -72,6 +73,7 @@ export function intersectResults< isFetching: toArray.some((v) => v().isFetching), error: toArray.find((v) => v().isError)?.error, data: undefined, + refetch, } as unknown as QueryObserverResult & { all: T }; if (mappedResult.isSuccess) {