Menu

1,186 empty comments sit between the words of our pages, and 213 more are Suspense boundaries with nothing in them
📰

1,186 empty comments sit between the words of our pages, and 213 more are Suspense boundaries with nothing in them

DEV Community: nextjs·Daniel Pertu·2 days ago
#AYYK4lm4
#devtonextjs#devto#dev#nodes#boundary
Long article (825 words) — no AI summary yet.
Reading 0:00
15s threshold

If you view source on nakodo.app and search for <!-- , you find comments that nobody wrote. There are two kinds, and they come from React rather than from us. I fetched all 106 pages in the sitemap and counted them.

Kind one: <!-- --> between two pieces of text

1,186 of them across the site. A median page has 10, the lowest has 3 and the most is 82, on the terms page . You can check that one in a terminal:

curl -s https://nakodo.app/terms | grep -o '<!-- -->' | wc -l

Enter fullscreen mode

Exit fullscreen mode

That prints 82, and the privacy page prints 64.

The rule is that when JSX produces two text nodes next to each other, the server writes a comment between them. The browser would otherwise merge the two into one text node on parse, and React, which expects two, could not find the second one to hydrate. The comment is a place to cut.

Three single lines in our code account for most of them:

The footer, which is on every page, reads © {thisYear()} {LEGAL.company} .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.