Skip to content

Full Toolkit for Next-Level Domain Analysis

Use `swr/immutable` 🧊

Felix Wotschofsky75d3f4b9fdbc
diff --git a/components/IpDetailsModal.tsx b/components/IpDetailsModal.tsx
index dc55fec..f4eba31 100644
--- a/components/IpDetailsModal.tsx
+++ b/components/IpDetailsModal.tsx
@@ -3,7 +3,7 @@ import type { LatLngExpression } from 'leaflet';
import naturalCompare from 'natural-compare-lite';
import dynamic from 'next/dynamic';
import { type FC } from 'react';
-import useSWR from 'swr';
+import useSWRImmutable from 'swr/immutable';
import {
Dialog,
@@ -44,7 +44,7 @@ const IpDetailsModal: FC<IpDetailsModalProps> = ({
open,
onOpenChange,
}) => {
- const { data, error } = useSWR<IpLookupResponse>(
+ const { data, error } = useSWRImmutable<IpLookupResponse>(
open ? `/api/lookupIp?ip=${encodeURIComponent(ip)}` : null
);
diff --git a/components/WhoisQuickInfo.tsx b/components/WhoisQuickInfo.tsx
index 17f5117..cfbecb2 100644
--- a/components/WhoisQuickInfo.tsx
+++ b/components/WhoisQuickInfo.tsx
@@ -1,7 +1,7 @@
'use client';
import type { FC } from 'react';
-import useSWR from 'swr';
+import useSWRImmutable from 'swr/immutable';
import { WhoisSummaryResponse } from '@/app/lookup/[domain]/whois-summary/route';
@@ -12,7 +12,7 @@ type WhoisQuickInfoProps = {
};
const WhoisQuickInfo: FC<WhoisQuickInfoProps> = ({ domain }) => {
- const { data, isLoading } = useSWR<WhoisSummaryResponse>(
+ const { data, isLoading } = useSWRImmutable<WhoisSummaryResponse>(
`/lookup/${domain}/whois-summary`
);