Skip to content

Commit 0011223

Browse files
Copilot0xrinegade
andcommitted
Fix TypeScript compilation and ESLint issues in VaultDashboard cleanup
Co-authored-by: 0xrinegade <[email protected]>
1 parent b06325c commit 0011223

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/pages/SurpriseVault/components/VaultDashboard.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,17 @@ const VaultDashboard: React.FC = () => {
8282

8383
// Cleanup VaultService on component unmount to prevent memory leaks
8484
useEffect(() => {
85-
return () => {
85+
const cleanup = () => {
8686
// Only call destroy if we're unmounting and vaultService exists
8787
if (vaultService && vaultService.destroy) {
88-
const timeoutId = setTimeout(() => {
89-
vaultService.destroy();
90-
}, 100);
91-
92-
return () => clearTimeout(timeoutId);
88+
vaultService.destroy();
9389
}
9490
};
95-
}, []); // Empty dependency array ensures this only runs on mount/unmount
91+
92+
// Return cleanup function
93+
return cleanup;
94+
// eslint-disable-next-line react-hooks/exhaustive-deps
95+
}, []); // Empty dependency array intentional - we only want this to run on mount/unmount
9696

9797
const handleJoinLottery = async () => {
9898
if (!vaultStats || !vaultService || !vaultService.joinLottery) return;

0 commit comments

Comments
 (0)