Skip to content

Commit

Permalink
fix: remove clone object in CallbackManager.dispatchEvent (#802)
Browse files Browse the repository at this point in the history
  • Loading branch information
himself65 authored May 3, 2024
1 parent 2008efe commit 5e61934
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-needles-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"llamaindex": patch
---

fix: remove clone object in `CallbackManager.dispatchEvent`
7 changes: 5 additions & 2 deletions packages/core/src/callbacks/CallbackManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,13 @@ export class CallbackManager implements CallbackManagerMethods {
if (!handlers) {
return;
}
const clone = structuredClone(detail);
queueMicrotask(() => {
handlers.forEach((handler) =>
handler(LlamaIndexCustomEvent.fromEvent(event, clone)),
handler(
LlamaIndexCustomEvent.fromEvent(event, {
...detail,
}),
),
);
});
}
Expand Down

0 comments on commit 5e61934

Please sign in to comment.