Skip to content

Full Toolkit for Next-Level Domain Analysis

Fix React render warnings: keyless fragments and div-in-p hydration 🧩👻 (#88)

Felix Wotschofsky0b5282a8d03c
diff --git a/app/lookup/[domain]/(dns)/_components/record-subvalues.tsx b/app/lookup/[domain]/(dns)/_components/record-subvalues.tsx
index 6a97241..cdd02b2 100644
--- a/app/lookup/[domain]/(dns)/_components/record-subvalues.tsx
+++ b/app/lookup/[domain]/(dns)/_components/record-subvalues.tsx
@@ -1,4 +1,4 @@
-import type { FC } from 'react';
+import { type FC, Fragment } from 'react';
import type { RecordContextEntry } from '@/lib/record-context';
@@ -9,7 +9,7 @@ type RecordSubvaluesProps = {
export const RecordSubvalues: FC<RecordSubvaluesProps> = ({ subvalues }) => (
<span className="mt-1 block text-xs break-words text-zinc-500 dark:text-zinc-400">
{subvalues.map((s, i) => (
- <>
+ <Fragment key={i}>
{i > 0 && ' / '}
{s.url ? (
<a
@@ -23,7 +23,7 @@ export const RecordSubvalues: FC<RecordSubvaluesProps> = ({ subvalues }) => (
) : (
s.description
)}
- </>
+ </Fragment>
))}
</span>
);
diff --git a/app/lookup/[domain]/(dns)/loading.tsx b/app/lookup/[domain]/(dns)/loading.tsx
index aef0dfb..8a7bc28 100644
--- a/app/lookup/[domain]/(dns)/loading.tsx
+++ b/app/lookup/[domain]/(dns)/loading.tsx
@@ -1,15 +1,14 @@
-/* eslint-disable react/jsx-key */
import { type FC, Fragment } from 'react';
import { Skeleton } from '@/components/ui/skeleton';
const DomainError: FC = () => (
<div className="mt-12">
- {Array.from({ length: 3 }).map(() => (
- <Fragment>
+ {Array.from({ length: 3 }).map((_, i) => (
+ <Fragment key={i}>
<Skeleton className="mt-8 mb-4 h-7 w-16 rounded-sm" />
- {Array.from({ length: 3 }).map(() => (
- <Skeleton className="my-3 h-5 w-full rounded-sm" />
+ {Array.from({ length: 3 }).map((_, j) => (
+ <Skeleton key={j} className="my-3 h-5 w-full rounded-sm" />
))}
</Fragment>
))}
diff --git a/app/lookup/[domain]/_components/star-reminder.tsx b/app/lookup/[domain]/_components/star-reminder.tsx
index ae4d500..6066af8 100644
--- a/app/lookup/[domain]/_components/star-reminder.tsx
+++ b/app/lookup/[domain]/_components/star-reminder.tsx
@@ -114,7 +114,8 @@ export const StarReminder: FC = () => {
<AlertDialogTitle className="text-center text-lg font-bold">
Enjoying Domain Digger?
</AlertDialogTitle>
- <AlertDialogDescription>
+ {/* asChild: the default <p> cannot contain the div/p children below */}
+ <AlertDialogDescription asChild>
<div className="space-y-4">
<div className="flex justify-center">
{data.recentStargazers.map((user, index) => (
diff --git a/app/lookup/[domain]/certs/_components/table.tsx b/app/lookup/[domain]/certs/_components/table.tsx
index 153e63c..6e57c43 100644
--- a/app/lookup/[domain]/certs/_components/table.tsx
+++ b/app/lookup/[domain]/certs/_components/table.tsx
@@ -1,6 +1,6 @@
'use client';
-import type { FC } from 'react';
+import { type FC, Fragment } from 'react';
import { SortableTable } from '@/components/sortable-table';
import type { CertsData } from '@/lib/certs';
@@ -46,14 +46,14 @@ export const CertsTable: FC<CertsTableProps> = ({ certs }) => (
label: 'Matching Identities',
render: (value) =>
value.split(/\n/g).map((value, index) => (
- <>
+ <Fragment key={index}>
{index !== 0 && <br />}
{isValidDomain(value) ? (
<DomainLink domain={value} />
) : (
<span>{value}</span>
)}
- </>
+ </Fragment>
)),
},
{