diff --git a/landing/src/components/modules/bridge-out-step-2.tsx b/landing/src/components/modules/bridge-out-step-2.tsx index 1691c01b9..b0cb882f1 100644 --- a/landing/src/components/modules/bridge-out-step-2.tsx +++ b/landing/src/components/modules/bridge-out-step-2.tsx @@ -86,26 +86,23 @@ export const BridgeOutStep2 = () => { const [selectedDonkeys, setSelectedDonkeys] = useState>(new Set()); const [isTableOpen, setIsTableOpen] = useState(false); - const updateResourcesFromSelectedDonkeys = useMemo( - () => (selectedDonkeyIds: Set) => { - const allResources = Array.from(selectedDonkeyIds).flatMap( - (id) => - donkeyInfos?.find((d) => d?.donkeyEntityId && BigInt(d.donkeyEntityId) === id)?.donkeyResourceBalances || [], - ); + const updateResourcesFromSelectedDonkeys = (selectedDonkeyIds: Set) => { + const allResources = Array.from(selectedDonkeyIds).flatMap( + (id) => + donkeyInfos?.find((d) => d?.donkeyEntityId && BigInt(d.donkeyEntityId) === id)?.donkeyResourceBalances || [], + ); - setSelectedResourceIds(allResources.map((r) => r.resourceId as never)); - setSelectedResourceAmounts( - allResources.reduce( - (acc, r) => ({ - ...acc, - [r.resourceId]: (acc[r.resourceId] || 0) + r.amount / RESOURCE_PRECISION, - }), - {}, - ), - ); - }, - [donkeyInfos, selectedDonkeys], - ); + setSelectedResourceIds(allResources.map((r) => r.resourceId as never)); + setSelectedResourceAmounts( + allResources.reduce( + (acc, r) => ({ + ...acc, + [r.resourceId]: (acc[r.resourceId] || 0) + r.amount / RESOURCE_PRECISION, + }), + {}, + ), + ); + }; useEffect(() => { const newSelected = new Set(); @@ -115,7 +112,7 @@ export const BridgeOutStep2 = () => { newSelected.add(BigInt(donkey?.donkeyEntityId || 0)); } }); - }, [donkeyInfos, selectedDonkeys]); + }, [donkeyInfos]); const handleRefresh = () => { setIsRefreshing(true); diff --git a/landing/src/hooks/helpers/useDonkeyArrivals.tsx b/landing/src/hooks/helpers/useDonkeyArrivals.tsx index fc4add932..a51a64c1c 100644 --- a/landing/src/hooks/helpers/useDonkeyArrivals.tsx +++ b/landing/src/hooks/helpers/useDonkeyArrivals.tsx @@ -34,8 +34,7 @@ export function useDonkeyArrivals(realmEntityIds: ID[]) { queryKey: ["donkeyEntityIds", realmId], queryFn: () => execute(GET_ETERNUM_ENTITY_OWNERS, { entityOwnerIds: [realmId] }), enabled: !!realmId, - refetchInterval: 10_000, - staleTime: 5000, + refetchInterval: 100_000, })), }); @@ -110,7 +109,9 @@ export function useDonkeyArrivals(realmEntityIds: ID[]) { }; const donkeyInfos = useMemo(() => { - return donkeysAtBank?.map((donkey) => donkey && getDonkeyInfo(donkey)); + return donkeysAtBank + ?.map((donkey) => donkey && getDonkeyInfo(donkey)) + .filter((info) => info?.donkeyResourceBalances.some((balance) => Number(balance.amount) > 0)); }, [donkeysAtBank, donkeyResources]); return {