next.js
d44ee523 - docs(opengraph-image): load assets at module scope to keep route static under Cache Components (#95246)

Commit
40 days ago
docs(opengraph-image): load assets at module scope to keep route static under Cache Components (#95246) ### What? Document loading request-independent assets at module scope, and update the OG image examples to follow it. ### Why? Reading a local asset inside the component is async I/O during render, so the route defers to request time. A top-level `await` at module scope keeps the route prerendered without reaching for `use cache`. The pattern previously only lived as an inline snippet in the OG image docs. ### How? - Add an "Asynchronous I/O at module scope" section to the Cache Components guide as the canonical explanation. - Load fonts and local assets at module scope in `opengraph-image.mdx` and `image-response.mdx`, and link both to the new section. <!-- NEXT_JS_LLM_PR --> --------- Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
Author
Parents
Loading