From 2f5ff79a73548f5af982b73341f4579bde758b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20Andre=20Tangen=20=40gorillatron?= Date: Fri, 6 Oct 2023 11:23:12 +0200 Subject: [PATCH] fix notifications revalidation --- components/top-bar/Alerts.tsx | 2 +- lib/hooks/queries/useRedeemableMarkets.ts | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/components/top-bar/Alerts.tsx b/components/top-bar/Alerts.tsx index 3d79f49f2..155020753 100644 --- a/components/top-bar/Alerts.tsx +++ b/components/top-bar/Alerts.tsx @@ -83,7 +83,7 @@ export const Alerts = () => { onMouseEnter={mouseEnterMenuHandler} onMouseLeave={mouseLeaveMenuHandler} className={` - fixed md:absolute left-0 md:translate-x-[50%] md:left-auto p-2 md:px-4 md:max-h-[700px] + fixed md:absolute left-0 md:translate-x-[50%] md:left-auto p-2 md:px-4 md:max-h-[664px] overflow-y-scroll md:right-0 bottom-0 md:bottom-auto z-50 py-3 top-11 md:top-auto mt-6 md:mt-6 w-full overflow-hidden h-full md:h-auto md:w-96 pb-20 md:pb-0 origin-top-right divide-gray-100 md:rounded-md focus:outline-none diff --git a/lib/hooks/queries/useRedeemableMarkets.ts b/lib/hooks/queries/useRedeemableMarkets.ts index 4e8ba56db..1f053da72 100644 --- a/lib/hooks/queries/useRedeemableMarkets.ts +++ b/lib/hooks/queries/useRedeemableMarkets.ts @@ -17,17 +17,22 @@ export const useRedeemableMarkets = (account?: string) => { const [sdk, id] = useSdkv2(); const { data: tokenPositions } = useAccountTokenPositions(account); - const enabled = - sdk && - account && - tokenPositions && - tokenPositions.length > 0 && - isIndexedSdk(sdk); + const enabled = sdk && account && tokenPositions && isIndexedSdk(sdk); return useQuery( - [id, redeemableMarketsRootKey, account], + [ + id, + redeemableMarketsRootKey, + account, + tokenPositions + ?.map((p) => p.id) + .sort() + .join("|"), + ], async () => { if (enabled) { + if (!tokenPositions.length) return []; + const outcomeAssetIds = tokenPositions .map((tokenPosition) => parseAssetId(tokenPosition.assetId).unwrapOr(null),