refactor: renames loading -> isInitializing

This commit is contained in:
Ben Kremer 2022-02-10 17:12:38 +01:00
parent 3bc76a24c0
commit 2b25de2f30
2 changed files with 8 additions and 10 deletions

View File

@ -45,7 +45,7 @@ export default function App() {
accounts,
balances,
fetching,
loading,
isInitializing,
setChains,
} = useWalletConnectClient();
@ -213,7 +213,7 @@ export default function App() {
<SLayout>
<Column maxWidth={1000} spanHeight>
<Header ping={onPing} disconnect={disconnect} session={session} />
<SContent>{loading ? "Loading..." : renderContent()}</SContent>
<SContent>{isInitializing ? "Loading..." : renderContent()}</SContent>
</Column>
<Modal show={!!modal} closeModal={closeModal}>
{renderModal()}

View File

@ -29,7 +29,7 @@ interface IContext {
session: SessionTypes.Created | undefined;
connect: (pairing?: { topic: string }) => Promise<void>;
disconnect: () => Promise<void>;
loading: boolean;
isInitializing: boolean;
fetching: boolean;
chains: string[];
pairings: string[];
@ -51,11 +51,9 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac
const [pairings, setPairings] = useState<string[]>([]);
const [session, setSession] = useState<SessionTypes.Created>();
// UI State
const [fetching, setFetching] = useState(false);
const [loading, setLoading] = useState(false);
const [isInitializing, setIsInitializing] = useState(false);
// Other entities
const [balances, setBalances] = useState<AccountBalances>({});
const [accounts, setAccounts] = useState<string[]>([]);
const [chains, setChains] = useState<string[]>([]);
@ -224,7 +222,7 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac
const createClient = useCallback(async () => {
try {
setLoading(true);
setIsInitializing(true);
const _client = await Client.init({
logger: DEFAULT_LOGGER,
@ -238,7 +236,7 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac
} catch (err) {
throw err;
} finally {
setLoading(false);
setIsInitializing(false);
}
}, [_checkPersistedState, _subscribeToEvents]);
@ -252,7 +250,7 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac
() => ({
pairings,
fetching,
loading,
isInitializing,
balances,
accounts,
chains,
@ -265,7 +263,7 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac
[
pairings,
fetching,
loading,
isInitializing,
balances,
accounts,
chains,