mirror of
https://github.com/Xevion/rdap.git
synced 2025-12-12 18:12:40 -06:00
Vercel linting error, removed unused import, add getTypeEasy callback dependency
This commit is contained in:
@@ -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 { domainMatchPredicate, getBestURL, getType } from "@/rdap";
|
||||||
import type {
|
import type {
|
||||||
AutonomousNumber,
|
AutonomousNumber,
|
||||||
@@ -55,7 +55,7 @@ const useLookup = (warningHandler?: WarningHandler) => {
|
|||||||
if (currentType != null) return Maybe.just(currentType);
|
if (currentType != null) return Maybe.just(currentType);
|
||||||
const uri: Maybe<TargetType> = (await getTypeEasy(target)).mapOr(Maybe.nothing(), (type) => Maybe.just(type));
|
const uri: Maybe<TargetType> = (await getTypeEasy(target)).mapOr(Maybe.nothing(), (type) => Maybe.just(type));
|
||||||
setUriType(uri);
|
setUriType(uri);
|
||||||
}, [target, currentType])
|
}, [target, currentType, getTypeEasy])
|
||||||
|
|
||||||
// Fetch & load a specific registry's data into memory.
|
// Fetch & load a specific registry's data into memory.
|
||||||
async function loadBootstrap(type: RootRegistryType, force = false) {
|
async function loadBootstrap(type: RootRegistryType, force = false) {
|
||||||
@@ -83,11 +83,12 @@ const useLookup = (warningHandler?: WarningHandler) => {
|
|||||||
|
|
||||||
async function getRegistry(type: RootRegistryType): Promise<Register> {
|
async function getRegistry(type: RootRegistryType): Promise<Register> {
|
||||||
if (registryDataRef.current[type] == null) await loadBootstrap(type);
|
if (registryDataRef.current[type] == null) await loadBootstrap(type);
|
||||||
if (registryDataRef.current[type] == null)
|
const registry = registryDataRef.current[type];
|
||||||
|
if (registry == null)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not load bootstrap data for ${type} registry.`
|
`Could not load bootstrap data for ${type} registry.`
|
||||||
);
|
);
|
||||||
return registryDataRef.current[type];
|
return registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getTypeEasy(target: string): Promise<Result<TargetType, Error>> {
|
async function getTypeEasy(target: string): Promise<Result<TargetType, Error>> {
|
||||||
|
|||||||
Reference in New Issue
Block a user