nuxt/nuxt

`<ServerOnly>` component (to render markup only once)

Open

#27,073 建立於 2024年5月6日

在 GitHub 查看
 (5 留言) (2 反應) (0 負責人)TypeScript (60,221 star) (5,607 fork)batch import
good first issueserver components🍰 p2-nice-to-have

描述

Describe the feature

I would like to add a footer to my page containing the generation timestamp. However, using new Date() does not really work as it is overriden with the current time after hydration. It would be great to have a <ServerOnly> component analog to the existing <ClientOnly> component.

I also tried to put it into defineAppConfig which is for "Public tokens that are determined at build time [...]" but that still leads to the date being hydrated on the client.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

貢獻者指南

`<ServerOnly>` component (to render markup only once) · nuxt/nuxt#27073 | Good First Issue