Skip to content

Commit

Permalink
add loading state
Browse files Browse the repository at this point in the history
  • Loading branch information
mamos-mysten committed May 31, 2024
1 parent 43350b2 commit 7c10f7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useCheckBlocklist } from '../../hooks/useDomainBlocklist';

export function useShowScamWarning({ hostname }: { hostname?: string }) {
const [userBypassed, setUserBypassed] = useState(false);
const { data } = useCheckBlocklist(hostname);
const { data, isPending } = useCheckBlocklist(hostname);
const bypass = () => setUserBypassed(true);

useEffect(() => {
Expand All @@ -19,6 +19,7 @@ export function useShowScamWarning({ hostname }: { hostname?: string }) {

return {
isOpen: !!data?.block && !userBypassed,
isPending: isPending,
userBypassed,
bypass,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ export function UserApproveContainer({
const { data: selectedAccount } = useAccountByAddress(address);
const parsedOrigin = useMemo(() => new URL(origin), [origin]);

const { isOpen, bypass } = useShowScamWarning({ hostname: parsedOrigin.hostname });
const {
isOpen,
isPending: isDomainCheckLoading,
bypass,
} = useShowScamWarning({ hostname: parsedOrigin.hostname });

return (
<>
Expand Down Expand Up @@ -110,7 +114,7 @@ export function UserApproveContainer({
handleOnResponse(true);
}}
disabled={approveDisabled}
loading={submitting || approveLoading}
loading={submitting || approveLoading || isDomainCheckLoading}
text={approveTitle}
/>
</>
Expand Down

0 comments on commit 7c10f7a

Please sign in to comment.