Skip to content

Commit

Permalink
fix: handle actOn dispatch correctly in replace items (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
jd1378 authored Jun 10, 2024
1 parent 1b9e4c5 commit 26850b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/replace-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import type { HookContext } from '@feathersjs/feathers';
export function replaceItems<H extends HookContext = HookContext>(context: H, items: any): void {
// @ts-ignore
if (context.params && context.params._actOn === 'dispatch') {
context.dispatch = items;
if (context.method === 'find' && context.dispatch?.data) {
context.dispatch.data = Array.isArray(items) ? items : [items];
} else {
context.dispatch = items;
}
return;
}

Expand Down

0 comments on commit 26850b5

Please sign in to comment.