Change to immutable SWR

This commit is contained in:
Willian Mitsuda 2021-12-18 07:09:10 -03:00
parent 7df1babd27
commit 61383a36d9
2 changed files with 4 additions and 4 deletions

View File

@ -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<FourBytesEntry | null | undefined>(
const { data, error } = useSWRImmutable<FourBytesEntry | null | undefined>(
rawFourBytes,
fourBytesFetcher
);

View File

@ -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;
}