Skip to content

Commit 26850b5

Browse files
authored
fix: handle actOn dispatch correctly in replace items (#751)
1 parent 1b9e4c5 commit 26850b5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utils/replace-items.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import type { HookContext } from '@feathersjs/feathers';
77
export function replaceItems<H extends HookContext = HookContext>(context: H, items: any): void {
88
// @ts-ignore
99
if (context.params && context.params._actOn === 'dispatch') {
10-
context.dispatch = items;
10+
if (context.method === 'find' && context.dispatch?.data) {
11+
context.dispatch.data = Array.isArray(items) ? items : [items];
12+
} else {
13+
context.dispatch = items;
14+
}
1115
return;
1216
}
1317

0 commit comments

Comments
 (0)