Skip to content

Commit 58787a2

Browse files
authored
[SDK] Fix useContractEvents persisting previous data when filters change (#7766)
1 parent e4ba47b commit 58787a2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/witty-ducks-lie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fixed `useContractEvents` persisting previous data when filters change

packages/thirdweb/src/react/core/hooks/contract/useContractEvents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export function useContractEvents<
9292
() =>
9393
events?.reduce((acc, curr) => {
9494
// we can use the event hash as a unique identifier?
95-
return `${acc}${curr.hash}_`;
95+
return `${acc}${curr.hash}${curr.topics.join("")}_`;
9696
}, "") || "__all__",
9797
[events],
9898
);

0 commit comments

Comments
 (0)