Skip to content

Commit 7917b92

Browse files
authored
Merge pull request #605 from PotLock/feature/matchingpool-sync
Feature/matchingpool sync
2 parents b7c1c90 + d02d71a commit 7917b92

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/layout/pot/components/layout.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { useCallback, useState } from "react";
1+
import { useCallback, useEffect, useState } from "react";
22

33
import Link from "next/link";
44
import { useRouter } from "next/router";
55

6-
import { indexer } from "@/common/api/indexer";
6+
import { indexer, syncApi } from "@/common/api/indexer";
77
import { PageWithBanner } from "@/common/ui/layout/components";
88
import { cn } from "@/common/ui/layout/utils";
99
import { useWalletUserSession } from "@/common/wallet";
@@ -36,6 +36,13 @@ export const PotLayout: React.FC<PotLayoutProps> = ({ children }) => {
3636
const { activeTab, orderedTabList } = usePotLayoutTabNavigation({ potId });
3737
const { data: pot } = indexer.usePot({ potId });
3838

39+
// Sync pot donations when returning from a wallet transaction (?done=true)
40+
useEffect(() => {
41+
if (query.done && potId) {
42+
syncApi.potDonations(potId).catch(() => {});
43+
}
44+
}, [query.done, potId]);
45+
3946
// Modals
4047
const [resultModalOpen, setSuccessModalOpen] = useState(!!query.done && !query.errorMessage);
4148
const [errorModalOpen, setErrorModalOpen] = useState(!!query.errorMessage);

0 commit comments

Comments
 (0)