diff --git a/src/use4Bytes.ts b/src/use4Bytes.ts index ea4f28c..8e6ef41 100644 --- a/src/use4Bytes.ts +++ b/src/use4Bytes.ts @@ -5,7 +5,7 @@ import { TransactionDescription, } from "@ethersproject/abi"; import { BigNumberish } from "@ethersproject/bignumber"; -import useSWR from "swr"; +import useSWRImmutable from "swr/immutable"; import { RuntimeContext } from "./useRuntime"; import { fourBytesURL } from "./url"; @@ -129,7 +129,7 @@ export const use4Bytes = ( return fetch4Bytes(assetsURLPrefix, key.slice(2)); }; - const { data, error } = useSWR( + const { data, error } = useSWRImmutable( rawFourBytes, fourBytesFetcher ); diff --git a/src/useResolvedAddresses.ts b/src/useResolvedAddresses.ts index 266a377..adc3819 100644 --- a/src/useResolvedAddresses.ts +++ b/src/useResolvedAddresses.ts @@ -1,7 +1,7 @@ import { useState, useEffect, useContext } from "react"; import { BaseProvider } from "@ethersproject/providers"; import { getAddress, isAddress } from "@ethersproject/address"; -import useSWR from "swr"; +import useSWRImmutable from "swr/immutable"; import { mainResolver } from "./api/address-resolver"; import { SelectedResolvedName } from "./api/address-resolver/CompositeAddressResolver"; import { RuntimeContext } from "./useRuntime"; @@ -79,7 +79,7 @@ export const useResolvedAddress = ( return mainResolver.resolveAddress(provider, address); }; - const { data, error } = useSWR(address, fetcher); + const { data, error } = useSWRImmutable(address, fetcher); if (error) { return undefined; }