Gezinmeyi atla
"Navigation feels slow in Next.js"
0:00 / 0:25

"Navigation feels slow in Next.js"

Alex Sidorenko

@asidorenko_35 B takipçi

X profili
1.557 beğeniİndirOrijinal gönderi

270.314 görüntüleme

"Navigation feels slow in Next.js" Try cacheComponents 👇

51 Yorum

Yorumlar X (Twitter) üzerindeki orijinal gönderiden alınmıştır

  • Alex Sidorenko profil fotoğrafı

    @asidorenko_

    My previous suggestion was to use loading.tsx, but with cacheComponents enabled, the actual part of your page outside of Suspense boundaries acts like loading.tsx (static, prefetched) I'm not sure if you need loading.tsx with cacheComponents at all

    49 beğeni

  • Muhammad Azamuddin profil fotoğrafı

    @azamuddin91

    Why another trick? Should it be default without developer thinking about yet another trick?

    28 beğeni

  • Muhammad Azamuddin profil fotoğrafı

    @azamuddin91

    Hmmm, I assume there might be gotchas since they don’t want to implement thisas default right away. Perhaps they’ve learnt from the default cache change in around v13 to v14 then revert in v15 What nextjs has become, don’t get me wrong, I still use Nextjs to this date but

    1 beğeni

  • Vlad Sazonau profil fotoğrafı

    @vladsazonau

    imo this is how it should've worked from the beginning with server components 😌

    21 beğeni

  • Alex Sidorenko profil fotoğrafı

    @asidorenko_

    @vlad_sazon Yep, implicitly static-by-default was not the best strategy for the app router. But I'd imagine it was tough to predict this for such a novel model as RSC Whoever paves the road for new technology pays the R&D price

    9 beğeni

  • Vlad Sazonau profil fotoğrafı

    @vladsazonau

    Yeah, make sense 🙏

    1 beğeni

  • ghazi profil fotoğrafı

    @muizahg

    Why not make it fast by default?

    6 beğeni

  • Léo Chéron profil fotoğrafı

    @mrgnou

    It doesn't work with dynamic routes so far :/

    5 beğeni

  • Kevin Möchel profil fotoğrafı

    @kevin_moechel

    The video is kinda misleading. I can achieve the exact same in Next 15. That's just RSC. The point of the cache is that on subsequent navigations there's no loading state. This wasn't shown in the video

    4 beğeni

  • Alex Sidorenko profil fotoğrafı

    @asidorenko_

    It was shown in the video. That's why you don't have lag during navigation on a dynamic page. You can only achieve this in Next 15 with PPR enabled. PPR is now part of cachedComponents model But the main point is that it's impossible to create a blocking route (it errors)

  • Kevin Möchel profil fotoğrafı

    @kevin_moechel

    Everything displayed in your video is easily done in Next 15, except the error when not using Suspense. The actual difference is that the Shell of the page is now served by the Vercel CDN which isn't the case in Next 15.

  • Alex Sidorenko profil fotoğrafı

    @asidorenko_

    "except" and "the actual difference" from your response is exactly the point of the video

  • ian profil fotoğrafı

    @iandavidandrino

    It felt slow locally, until I upgraded to nextjs 16 and upgraded to stable react-compiler 🤯 Now it navigates before I even blink

    3 beğeni

  • Matt Teixeira profil fotoğrafı

    @matt_teeixeira

    This only for Next 16?

    3 beğeni

  • Alex Sidorenko profil fotoğrafı

    @asidorenko_

    @Matt_TeixeiraBR Yep

    3 beğeni

  • Petsoni profil fotoğrafı

    @petsonii

    damn this is something new for me gonna try it out, thank you 🙌🏼

    2 beğeni

  • CodeHagen profil fotoğrafı

    @CodeHagen

    Need to try, great one ✨

    2 beğeni

  • Lukas profil fotoğrafı

    @quick007YT

    how does this actually improve performance? does it just give a warning when you forgot to use suspense or does it do more under the hood?

    2 beğeni

  • Alex Sidorenko profil fotoğrafı

    @asidorenko_

    It pre-generates everything outside Suspense as a static shell during the build time. This shell is prefetched by Links, so navigation is always fast. This was called partial pre-rendering before. Now it's a part of the cacheComponents model.

    5 beğeni

  • Lukas profil fotoğrafı

    @quick007YT

    makes sense! I'm familiar with PPR so hopefully cache components will fit into that mental model.

    1 beğeni