#Suspense or other loading indicator for generateMetadata

2 messages · Page 1 of 1 (latest)

toxic crown
#

Hi Guys! I'm working on a project that uses an API that is quite slow, sometimes a request takes ~2-3s. I can't do anything about the API so I would like to be sure, that users will get some visual indication that something is loading under the hood when navigating my site. What is more, the project will have around ~1M pages (let's call them product pages) and it is very highly possible that one product will be opened only by one person, only once. That's why I don't want to depend on cache.

I realised that when going to (clicking on a link) a page that is using generateMetadata there is no indication that something is loading untill the fetch request from inside the generateMetadata finishes. So for a user, that clicks on a Link to a page, nothing happens for 2-3 seconds. The browser is not showing that anything is loading and react's suspense is not triggered.

I've created a minimal reproduction of this issue here:
https://codesandbox.io/p/github/wiwo-dev/generatemetadata-loading-issue/main
And here is the repo for this: https://github.com/wiwo-dev/generatemetadata-loading-issue

GitHub

Contribute to wiwo-dev/generatemetadata-loading-issue development by creating an account on GitHub.

grand saffronBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)