Loading video...

Video Failed to Load

Go Home

cacheComponents in Next.js (canary)

38,460 views • 1 year ago •via X (Twitter)

23 Comments

Alex Sidorenko's profile picture
Alex Sidorenko1 year ago

There is more to cacheComponents, of course. I will create a few more vids But it seems to fix the accidental dynamic rendering problem which is huge. Rendering strategy and caching gets much more explicit

Jon's profile picture
Jon1 year ago

Have you checked this out yet? The cacheComponents thing isn’t working when deploying to Vercel. Locally (build/start) it works fine though.

Alex Sidorenko's profile picture
Alex Sidorenko1 year ago

Nope, thanks for the link. It's still experimental and in canary, I wouldn't use it in prod rn Can't wait for the stable release. It is a huge and much-needed shift towards explicit caching and rendering.

Jon's profile picture
Jon1 year ago

I can’t wait either. It’s been experimental for way too long. Once this is stable it’ll make Next.js great again. Just fix it already.

Leonardo Dominguez's profile picture
Leonardo Dominguez1 year ago

is this a future successor to PPR?

Alex Sidorenko's profile picture
Alex Sidorenko1 year ago

Yep, it combines ppr, dynamic IO, and "use cache" into one flag

aymen bachiri's profile picture
aymen bachiri1 year ago

👏

Big bro's profile picture
Big bro1 year ago

im so <Awaited /> pilled at this point for some reason yet still miss nextjs😭

Alex Sidorenko's profile picture
Alex Sidorenko1 year ago

It feels like cacheComponents fixes the most fundamental problem of the app router. But hard to tell until the stable release

Tom Sherman's profile picture
Tom Sherman1 year ago

If they can figure out skipping those cached components in SSR then it could save billions of dollars in compute

Dale's profile picture
Dale1 year ago

This seems like PPR

Zain's profile picture
Zain1 year ago

I like your wallpaper. Can you share it?

Alex Sidorenko's profile picture
Alex Sidorenko1 year ago

It's one of the backgrounds from @screenstudio

abir's profile picture
abir1 year ago

Unfortunately my biggest reason for using server components, was to get rid of as much loading state as possible. Not worth it to introduce this caching if it means users now have to see loading states.

Dustin's profile picture
Dustin1 year ago

This new feature looks promising for improving performance and developer experience. Can't wait to see how it evolves and impacts future Next.js projects.

Abundance Ken-Dickson's profile picture
Abundance Ken-Dickson1 year ago

Im curious: Are there any specific use cases?

Alex Sidorenko's profile picture
Alex Sidorenko1 year ago

Demo from the video fixes this problem

Min Chon Chi's profile picture
Min Chon Chi1 year ago

Looking forward to seeing the final version of cacheComponents in Next.js.

The Doctor's profile picture
The Doctor1 year ago

Does this cache on the local development?

Mohit Nagaraj ☄️'s profile picture
Mohit Nagaraj ☄️1 year ago

cacheComponents in Next.js canary looks like a solid performance boost for frequently accessed UI elements- definitely worth exploring for optimizing render times and reducing server load

Kajetan Szymczak's profile picture
Kajetan Szymczak1 year ago

Do I need to explicitly cache calls such as 'getUser' to cache them between multiple server components?

Alex Sidorenko's profile picture
Alex Sidorenko1 year ago

If you mean memoization (to avoid triggering a function multiple times during a single request), then yes. However, it works more like deduping than a persistent cache The name of this function causes a lot of confusion

Kajetan Szymczak's profile picture
Kajetan Szymczak1 year ago

Yes, I meant that cache (which is memoization) from react ;) So it looks very similar to ppr but without "ppr" flag

Related Videos