Skip to content

Commit d834c9b

Browse files
committed
feat: improve storage life cycle
1 parent 8959bea commit d834c9b

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/components/ui/card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const CardTitle = React.forwardRef<
3333
HTMLParagraphElement,
3434
React.HTMLAttributes<HTMLHeadingElement>
3535
>(({ className, ...props }, ref) => (
36-
<h3
36+
<div
3737
ref={ref}
3838
className={cn(
3939
"text-xl font-semibold leading-none tracking-tight",

src/pages/[query].tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
Send,
2121
X,
2222
} from "lucide-react";
23-
import React, { useMemo } from "react";
23+
import React, { useEffect, useMemo } from "react";
2424
import { addHistory } from "@/lib/history";
2525
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
2626
import { Badge } from "@/components/ui/badge";
@@ -320,9 +320,12 @@ export default function Lookup({ data, target }: Props) {
320320

321321
const goStage = (target: string) => {
322322
setLoading(true);
323-
addHistory(target);
324323
};
325324

325+
useEffect(() => {
326+
addHistory(target);
327+
}, []);
328+
326329
return (
327330
<ScrollArea className={`w-full h-full`}>
328331
<main
@@ -386,7 +389,7 @@ export default function Lookup({ data, target }: Props) {
386389
</div>
387390
<ResultComp data={data} target={target} />
388391
</div>
389-
<p
392+
<div
390393
className={`mt-12 text-sm flex flex-row items-center font-medium text-muted-foreground select-none`}
391394
>
392395
Powered by{" "}
@@ -398,7 +401,7 @@ export default function Lookup({ data, target }: Props) {
398401
Next Whois UI
399402
</Link>
400403
<Badge variant={`outline`}>v{VERSION}</Badge>
401-
</p>
404+
</div>
402405
</main>
403406
</ScrollArea>
404407
);

src/pages/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export default function Home() {
2222

2323
const goStage = (target: string) => {
2424
setLoading(true);
25-
addHistory(target);
2625
};
2726

2827
return (
@@ -94,7 +93,7 @@ export default function Home() {
9493
key={index}
9594
onClick={() => goStage(item)}
9695
>
97-
<Link2 className={`w-4 h-4 mr-1`} />
96+
<Link2 className={`w-4 h-4 mr-1 shrink-0`} />
9897
{item}
9998
<ChevronRight
10099
className={`transition-all w-4 h-4 ml-auto mr-1 group-hover:mr-0`}

0 commit comments

Comments
 (0)