Skip to content

Commit 7e99c63

Browse files
fix: add suspense to tag
1 parent ed4eaa1 commit 7e99c63

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

app/share/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import ArticleBlock from "@components/ArticleBlock";
22
import { posts, Post } from "@content";
33
import { Metadata } from "next";
4-
import TagFilteredList from "@/components/TagFilteredList";
5-
import { Tag } from "@components/Tag";
4+
import TagFilteredList from "@components/TagFilteredList";
5+
import Tag from "@components/Tag";
66

77
export const metadata: Metadata = {
88
title: "Share",

components/ArticleBlock.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import { format } from "date-fns";
33
import Link from "next/link";
44
import { CalendarIcon } from "./icons/CalendarIcon";
5-
import { Tag } from "@components/Tag";
5+
import Tag from "@components/Tag";
66

77
interface ArticleBlockProps {
88
slug: string;

components/Tag.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

3-
import Link from "next/link";
43
import { usePathname, useRouter, useSearchParams } from "next/navigation";
4+
import { Suspense } from "react";
55

66
interface TagProps {
77
tag: string;
@@ -12,7 +12,7 @@ interface TagProps {
1212
* A tag component that can be used to filter content by tag.
1313
* If no children are provided, the tag string will be displayed.
1414
*/
15-
export function Tag({ tag, children }: TagProps) {
15+
function SuspenseTag({ tag, children }: TagProps) {
1616
const searchParams = useSearchParams();
1717
const pathname = usePathname();
1818
const { replace } = useRouter();
@@ -50,3 +50,11 @@ export function Tag({ tag, children }: TagProps) {
5050
</button>
5151
);
5252
}
53+
54+
export default function Tag({ tag, children }: TagProps) {
55+
return (
56+
<Suspense>
57+
<SuspenseTag tag={tag}>{children}</SuspenseTag>
58+
</Suspense>
59+
);
60+
}

0 commit comments

Comments
 (0)