From 2d31d46dbda5931179bb7c6c3ddcce5fe86865a7 Mon Sep 17 00:00:00 2001 From: Bill He Date: Tue, 29 Aug 2023 12:01:43 -0700 Subject: [PATCH] polish --- src/hooks/useLocalNotifications.tsx | 4 +++- src/hooks/useNotifications.tsx | 4 ---- src/views/forms/AccountManagementForms/WithdrawForm.tsx | 2 -- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/hooks/useLocalNotifications.tsx b/src/hooks/useLocalNotifications.tsx index c1ae891..881aaf1 100644 --- a/src/hooks/useLocalNotifications.tsx +++ b/src/hooks/useLocalNotifications.tsx @@ -22,6 +22,8 @@ export const LocalNotificationsProvider = ({ ...props }) => ( export const useLocalNotifications = () => useContext(LocalNotificationsContext)!; +const TRANSFER_STATUS_FETCH_INTERVAL = 10_000; + const useLocalNotificationsContext = () => { // transfer notifications const [allTransferNotifications, setAllTransferNotifications] = useLocalStorage<{ @@ -70,7 +72,7 @@ const useLocalNotificationsContext = () => { } return statuses; }, - refetchInterval: 10_000, + refetchInterval: TRANSFER_STATUS_FETCH_INTERVAL, }); useEffect(() => { diff --git a/src/hooks/useNotifications.tsx b/src/hooks/useNotifications.tsx index 6e2ed47..6c97009 100644 --- a/src/hooks/useNotifications.tsx +++ b/src/hooks/useNotifications.tsx @@ -1,21 +1,17 @@ import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react'; -import { useQuery } from 'react-query'; import { LocalStorageKey } from '@/constants/localStorage'; import { type Notification, type NotificationDisplayData, type Notifications, - type TransferNotifcation, NotificationStatus, } from '@/constants/notifications'; -import { useSquid } from '@/hooks/useSquid'; import { useLocalStorage } from './useLocalStorage'; import { notificationTypes } from './useNotificationTypes'; import { renderSvgToDataUrl } from '../lib/renderSvgToDataUrl'; -import { StatusResponse } from '@0xsquid/sdk'; const NotificationsContext = createContext | undefined>( undefined diff --git a/src/views/forms/AccountManagementForms/WithdrawForm.tsx b/src/views/forms/AccountManagementForms/WithdrawForm.tsx index 265ac63..5a0e101 100644 --- a/src/views/forms/AccountManagementForms/WithdrawForm.tsx +++ b/src/views/forms/AccountManagementForms/WithdrawForm.tsx @@ -66,8 +66,6 @@ export const WithdrawForm = () => { const { addTransferNotification } = useLocalNotifications(); // Async Data - const [transactionHash, setTransactionHash] = useState(); - const debouncedAmountBN = MustBigNumber(debouncedAmount); const withdrawAmountBN = MustBigNumber(withdrawAmount); const freeCollateralBN = MustBigNumber(freeCollateral?.current);