Skip to content

Commit

Permalink
force-dynamic page
Browse files Browse the repository at this point in the history
  • Loading branch information
cesara committed Dec 13, 2023
1 parent 181a37c commit 24f2664
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions examples/tiptap/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { nanoid } from "nanoid";
import { redirect } from "next/navigation";

export const dynamic = "force-dynamic";

function Page() {
redirect("/r/" + nanoid(6));
}
Expand Down
15 changes: 11 additions & 4 deletions examples/tiptap/src/app/r/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
"use client";
import { TextEditor } from "@/components/TextEditor";
import { useEffect, useState } from "react";

export default function Home() {
const [, , roomID] = location.pathname.split("/");
const [roomID, setRoomID] = useState<string | null>(null);
useEffect(() => {
const [, , roomID] = location.pathname.split("/");
setRoomID(roomID);
}, []);

return (
<main>
<TextEditor roomID={roomID} />
</main>
roomID && (
<main>
<TextEditor roomID={roomID} />
</main>
)
);
}

0 comments on commit 24f2664

Please sign in to comment.