From b257fcaa5a652f74eb224d9d5b6a2b0e791251c7 Mon Sep 17 00:00:00 2001 From: Ashutosh0x Date: Sat, 13 Jun 2026 18:41:51 +0530 Subject: [PATCH] fix: consistent note object type in Server Components docs Fixes #6933 The Server Components docs page had inconsistent handling of the note variable across 3 code examples. All examples now consistently treat note as an object with .authorId, .id, and .content properties. --- src/content/reference/rsc/server-components.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/content/reference/rsc/server-components.md b/src/content/reference/rsc/server-components.md index cf33f7d2405..73215ddd2be 100644 --- a/src/content/reference/rsc/server-components.md +++ b/src/content/reference/rsc/server-components.md @@ -100,7 +100,7 @@ Without Server Components, it's common to fetch dynamic data on the client in an ```js // bundle.js function Note({id}) { - const [note, setNote] = useState(''); + const [note, setNote] = useState(null); // NOTE: loads *after* first render. useEffect(() => { fetch(`/api/notes/${id}`).then(data => { @@ -108,10 +108,14 @@ function Note({id}) { }); }, [id]); + if (!note) { + return null; + } + return (
-

{note}

+

{note.content}

); } @@ -155,7 +159,7 @@ async function Note({id}) { return (
-

{note}

+

{note.content}

); } @@ -269,7 +273,7 @@ async function Page({id}) { const commentsPromise = db.comments.get(note.id); return (
- {note} +

{note.content}

Loading Comments...

}>