#How to use Suspense in _app.tsx?

26 messages · Page 1 of 1 (latest)

zenith eagle
#

Hi foks. I have a project on NextJS 12 and I need Suspense to wait for the loading of data. However, when I wrap my component into <Suspense/> it never resolves and just hanging on "loading..." forever. Any ideas what can go wrong?

spark smeltBOT
#

🔎 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)

floral cypress
#

Probably a better idea to switch to NextJS 13 before any of this

#

Nextjs 13 does support pages router.

zenith eagle
#

I can't switch to Next 13

#

It's difficult to find a sandbox with Next 12 support, I found some old template tho.

#

Here is an example of the problem:

#

Maybe I do something wrong, because I don't have much of experience with Suspense

#

If you open the index page - it's fine.
But if you click the About link, you'll see loading forever

#

Here is an example w/o Next and it works fine:

floral cypress
#

Why can you not switch to Next 13? Even if it was a problem we can't really help since you are literally a major version behind

zenith eagle
#

Becase there is a bunch of code?

#

Usual things

#

Next 13 is not fully backward compatible with Next 12

#

So no, can't switch

#

Also, I wonder if support of Next 12 is over

#

Usually, support of majors continues for years

floral cypress
simple nexus
#

You can upgrade from next 12 -> Next 13 without any problem.
just npm i next@latest

#

no need to migrate

simple nexus
#

have you tried it?

floral cypress
#

That looks ai generated to me

fickle viper