From bb4ba75b389b67029435f304b6ab7ab0fcdd9564 Mon Sep 17 00:00:00 2001 From: Xevion Date: Sun, 12 May 2024 16:31:56 -0500 Subject: [PATCH] Vercel linting error, removed unused import, add getTypeEasy callback dependency --- src/hooks/useLookup.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/hooks/useLookup.tsx b/src/hooks/useLookup.tsx index e086ff4..8095370 100644 --- a/src/hooks/useLookup.tsx +++ b/src/hooks/useLookup.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import { useCallback, useEffect useRef, useState } from "react"; import { domainMatchPredicate, getBestURL, getType } from "@/rdap"; import type { AutonomousNumber, @@ -55,7 +55,7 @@ const useLookup = (warningHandler?: WarningHandler) => { if (currentType != null) return Maybe.just(currentType); const uri: Maybe = (await getTypeEasy(target)).mapOr(Maybe.nothing(), (type) => Maybe.just(type)); setUriType(uri); - }, [target, currentType]) + }, [target, currentType, getTypeEasy]) // Fetch & load a specific registry's data into memory. async function loadBootstrap(type: RootRegistryType, force = false) { @@ -83,11 +83,12 @@ const useLookup = (warningHandler?: WarningHandler) => { async function getRegistry(type: RootRegistryType): Promise { if (registryDataRef.current[type] == null) await loadBootstrap(type); - if (registryDataRef.current[type] == null) + const registry = registryDataRef.current[type]; + if (registry == null) throw new Error( `Could not load bootstrap data for ${type} registry.` ); - return registryDataRef.current[type]; + return registry; } async function getTypeEasy(target: string): Promise> {