The Worst Thing About Next.js 13

  Рет қаралды 34,570

Josh tried coding

Josh tried coding

11 ай бұрын

Caching in NextJS sucks. Many people have issues with it and as of now, there is no clear solution. Just clunky workarounds. This problem really annoys me, and it's been a pain to deal with for past projects.
GitHub issue for updates: github.com/vercel/next.js/iss...
One example in this video was inspired by theo: / 1677448388772790272
-- links
Discord: / discord
My GitHub: github.com/joschan21

Пікірлер: 228
@thesunabsolute
@thesunabsolute 11 ай бұрын
I'm happy content creators are starting to catch on to these issues and making them known. This has been an open issue in github for a while now.
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
It's open since last year.. crazy
@nested9301
@nested9301 11 ай бұрын
can u provide the link for the issue?
@magne6049
@magne6049 5 ай бұрын
@@nested9301 it's issue 51788
@sonmoosans
@sonmoosans 11 ай бұрын
The most painful point is that it sometimes has different behaviours on production mode and development mode
@alext5497
@alext5497 11 ай бұрын
theres no caching at all in dev mode. You have to build and start to test properly
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
Yeah! This really surprised me after deploying the Reddit clone a while back. Super weird to first notice in prod. And to simply reproduce the issue you'd have to build out the app every time.
@SlayDota9
@SlayDota9 11 ай бұрын
@@joshtriedcoding not for me, i just started a new project to learn nextjs 13 and noticed this behavior in development when using Link component.
@SlayDota9
@SlayDota9 11 ай бұрын
the behavior is that if I edit a page thats not the currently active page on my browser: it wont change if i navigate to it using Link, but will change if request it from serve ofc. however if i edited the currently active page on the browser, it will detect the changes
@raihan7422
@raihan7422 11 ай бұрын
@@joshtriedcoding I thought I'm the only one having caching issues
@BeyondLegendary
@BeyondLegendary 11 ай бұрын
Impressive, very nice. Let's see Paul Allen's workaround.
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
Paul Allen prolly got a goofy ah workaround 💀
@WebDevCody
@WebDevCody 11 ай бұрын
That discord poll looks very familiar 😂 btw, you can just wait 30 seconds before you navigate to a new page and your client router will clear the cache. I was honestly going to make a video about all of this, but I decided I’ve publicly hated on next.js enough for a bit and for my sanity I’m just accepting this framework is still alpha.
@ravi_sorathiya
@ravi_sorathiya 11 ай бұрын
Excelty what i was thinking That you have address this is isuue 😂 but loved that he trying to make really good content on this But surely he must gives the credit to you😂
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
Hahaha yeah, I've been following you closely on Twitter, the sentiment is definitely clear. Do you know if there is a way of adjusting those 30 seconds to a custom value or prevent this behavior altogether? Totally forgot to include your Twitter poll that I copied for my discord, wanted to show them side by side to make the point even more clear
@WebDevCody
@WebDevCody 11 ай бұрын
@@joshtriedcoding nope I don’t know of a way to customize this 30 second cache. I’m sure they’ll fix this at some point if people complain enough.
@julianpera
@julianpera 11 ай бұрын
Client cache is not the same as server cache. Everything you've shown on the video is related to server cache, which actually doesn't run at all in a development environment. Server cache prevents a re-render of server components on the server, storing the resulting plain-html for that specific page, ready to be served, avoiding db calls, business logic, etc. You decide when that render should happen using the options you've shown on the video. Then, when a client request that page, it's cached on the client as well to avoid multiple request on navigation, triggering a request on first page render only and storing the result on memory. On subsequential navigations, it will be readed from there. That's why server configuration seems to do nothing: it isn't being called at all. Sadly, there isn't an available API to config client cache behaviour yet. For now, you can use router.refresh() to force a client refresh, and useTransition to show some indicators. I hope they add new features related to this topic as soon as possible!
@alejandroguillamon
@alejandroguillamon 11 ай бұрын
Most people are missing this point, thanks for putting it out there.
@essaadi_elmehdi6784
@essaadi_elmehdi6784 11 ай бұрын
Thanks for the explanation, now I understand why that happening.
@justindoane7482
@justindoane7482 11 ай бұрын
This! Before server actions were added to the docs it use to say to wrap router.push and then router.refresh in the new transition hook. Doing this will continue to have client side navigation while also properly hydrating the new data fetched from the server. I think the solution to this in the future should just be a prop on the Link that allows soft or hard navigation.
@27455628
@27455628 11 ай бұрын
sorry, I am pretty new to this, but does it mean this behavior apply to old version of nextjs and reactjs too? I am currently considering whether or not I should learn Nextjs 13
@essaadi_elmehdi6784
@essaadi_elmehdi6784 11 ай бұрын
@@27455628 This apply to the new version that is Nextjs 14
@ilijanl
@ilijanl 11 ай бұрын
Seems that engineers of nextjs do not know the quote "There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton " Caching should always be an opt-in not opt-out. And something with pre-optimalisation is root of all evil
@abdullafaizov7963
@abdullafaizov7963 11 ай бұрын
Damn bro, you seem to really now your sh*t
@TheFourthPrince
@TheFourthPrince 11 ай бұрын
Josh, all your Next.js 13 related videos were helpful to me. Will you please create a playlist on your channel for Next.js 13?
@nithin3476
@nithin3476 11 ай бұрын
just learn with projects and doc(its really good)
@akuoko_konadu
@akuoko_konadu 11 ай бұрын
I love your videos Johs 😍, but here's my take: If it's a simple page you can create a client component and use React.useEffect() to always revalidate the data. And if you happen to have some data that must be only on the server you can pass it as props or children of that client component. Since we're listing problems let me tell you one of mine 😂: in NextJs 13 if you happen to have set serverActions to true in next.config.js, if you're using dynamic meta and title tags in your head components this behavior also occurs, thus it'll revalidate when you move to a new page(using the Link component) on the first request, but in when you move to another new page the tags would still be the same, it can't revalidate the tags from request 2 and upwards. Nice video 🎉
@ozzyfromspace
@ozzyfromspace 11 ай бұрын
Hey Josh, I love your content! I have a comment about a possible good way to think about this: React Server Components only run once on the first request. That's why whenever you refresh or use a link component (which actually makes a request to the server, then caches the page -- same as NextJS 12) we get fresh data, then cached data on subsequent client-side requests. I actually think this makes sense because Math.random in your example exists on the server side, not the client-side. So yes, the page isn't cached, but you only ever hit it once, on the first request. I'm using NextJS 13 for a freelance project and the way I handle this behavior is by treating the server as a way to generate SEO-friendly "initial" content. My server-state management tool of choice is tanstack-query (formerly react-query). Tanstack query allows you to pre-populate your data cache with this initial data and bound it to a route (see: tanstack.com/query/v4/docs/react/guides/ssr#using-the-app-directory-in-nextjs-13). Then on subsequent *client*-side requests, tan-stack takes over as needed, based on your revalidation rules. As a bonus, you can set tan-stack query up so that it doesn't fetch on mount, because theoretically, the server gave good data. So, I don't necessarily think this is a problem. We just need to remember that only the first request is a server-side request. All other requests are client-side requests. NextJS Links break this rule because if the client-side router hasn't seen a given route before, it pre-fetches it on the server, then caches the result for subsequent requests. Simply focusing the link is enough to trigger this in the background, which is a nice touch, actually. In the case of your example, I would generate your random number on the server and pass it as props to a client-side view component. Initialize a random number state using the server prop, and handle updates to the random number on the client (or make requests to the server when required). As a bonus, a completely different way to solve this problem would be to use server-actions that run when page component un-mounts. I think this could work because a getRandomNumber() action wouldn't need to hold state, so we could safely share it between resources. Something like that, but I haven't tried it. Do you agree with this pattern? I feel that server-side data should be treated as "initial" data as you demonstrated. It's a little frustrating because you have to also handle client-side updates to said data, but I think it's a fair price to pay for SSR. Again, awesome video! NextJS 13 is an interesting time to discover new patterns and way of thinking about how we write our programs. Best wishes with your YT channel! - Ozzy.
@ayushjain7023
@ayushjain7023 11 ай бұрын
one way to solve is to use prefetch={false} in link. The approach of prefetch as false doesn’t solve if one uses browsers back button, I fixed this using router.refresh() inside useeffect in a client component and add it in server component 😉
@shanemarchan658
@shanemarchan658 11 ай бұрын
this seems to be the only working solution thus far..
@ruel1983
@ruel1983 11 ай бұрын
Im usually doesn’t comment, but you are a life saver. Im on the path to choose next.js and server components for our brand new startup tech stack. This video is a clear example why we shouldn’t rush to choose server components for real-world production.
@snivels
@snivels 11 ай бұрын
If you add prefetch={false} onto your tag AND you are running your entire app route off a dynamic segment (think next-intl locale), it seems to not cache using your example of reading a file, changing the file, then navigating back. This will mean that your root app is no longer '/' but '/en/'. So in your example the pages would navigate between Other page and Home page
@keshavakumar9828
@keshavakumar9828 11 ай бұрын
I learned about the next.js caching problem when I made your real-time chat app where you create a helper function to avoid the default cache mechanism provided by Next. learning new things from you every day
@dominikwozniak4317
@dominikwozniak4317 11 ай бұрын
hi, can you point out where helper function was used?
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
Very happy to hear that man! @dominik, the helper function is used to fetch data from redis without caching interference
@miro-hristov
@miro-hristov 11 ай бұрын
Great to know that finally someone brought awareness to the issue. Keep up the good work Josh!
@mac2196
@mac2196 11 ай бұрын
Doesn't this mean that there's client side caching? When you click on the links in the page after revalidating with the `/revalidate?path=other`, does refreshing the page work? Wouldn't the solution be from the perspective of client components, rather than only service side components?
@romankoshchei
@romankoshchei 11 ай бұрын
Does it happen when you use fetch or only when something else?
@Zatura24
@Zatura24 11 ай бұрын
Afaik the client refreshes server components after 30 seconds if they are not navigated to within that time. I tought disabling prefetching inside the Link components gets the desired behaviour, otherwise hard navigation with a 'a' tag.
@jonny555333
@jonny555333 11 ай бұрын
Just some additional information, revalidatePath only adds that route to a queue to revalidate the next time that page is requested from the server. It does not do it on-demand. RevalidateTag is only one that actually revalidates on-demand and then sends a request to the server.
@codinginflow
@codinginflow 11 ай бұрын
RevalidatePath does refresh the page if you call it in a server action. Don't know about route handlers tho.
@jonny555333
@jonny555333 11 ай бұрын
@@codinginflow Not according to their docs but maybe they just didn't document it well. But one thing I can confirm is that it does not work for dynamic routes. revalidatePath does not work at all for dynamic routes. RevalidateTag however does work on dynamic routes.
@WolfrostWasTaken
@WolfrostWasTaken 11 ай бұрын
This video is a godsend for people new to Next.js 13. This kind of behaviour is why I'm very paranoid and I often build and test the built app instead of using dev mode. Of course this has bad DX but what can you do...
@StewchaKun
@StewchaKun 11 ай бұрын
we started our new project in company using nextjs because from all perspectives it looked perfect for our project and worked for 3 weeks on it, and in that time we found so much issues and we had to google it, ask people on forums and everywhere to find solution and create a lot of workaround in order to make it work, nextjs was limited so much and doesnt give you freedom because of that, and some stuff looked like force you to use some thirdparty things that you dont want but you need, on other side nextjs is very easy and have so much unique things that its defintly worth it to learn and create some project with it, but for some complex projects there is a still long way to mature so you can use it, at the end we abandoned nextjs development and return to old good php which handled everything with easy.
@luke0750
@luke0750 10 ай бұрын
It has been fixed guys you can add export const dynamic = "force-dynamic" to make it dynamc
@iPankBMW
@iPankBMW 11 ай бұрын
FINALLY - some1 addresses this MAJOR BUG! I started to hate cache with v13 Nextjs… Websites with higly dynamic pages as estore suffers ALOT!
@berrymatondo2948
@berrymatondo2948 10 ай бұрын
Hi Josh, Any solution regarding this problem ? I have the same issue, ...painfull
@dauta
@dauta 11 ай бұрын
I had a very similar issue and went through the exact same thought process as you. The only thing that fixed it was setting prefetch={false} on the Link component. Not sure if it works for your use-case, but thought I'd share. As to why it works: 🤷
@snivels
@snivels 11 ай бұрын
That does, indeed, solve the problem. No workarounds needed, as it's part of the Link interface itself. Edit: Prefetch didn't actually work for me, I had to add prefetch AND run my entire app from a dynamic-route. Think about how next-intl does it by prefixing routes with /en/ or /fr/ or whatever.
@dauta
@dauta 11 ай бұрын
@@snivels Yeah, it has to be better documented though. The connection is extremely unclear. I literally spent days debugging this issue
@snivels
@snivels 11 ай бұрын
@@dauta Definitely agree that their documentation needs work. Especially with such drastic new changes.
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
Thanks for sharing! I've linked a GitHub issue for this in the description containing all the workarounds - hopefully there's gonna be some well-documented implementation for this soon
@TheOaksandCVP
@TheOaksandCVP 11 ай бұрын
I had this problem with nextjs in production. The work around for me was simple, add "console.log(request.url)" in my non dynamic GET route handlers so handlers that look like " export async function GET(request: NextRequest) {} " and not "export async function GET(request: NextRequest, context: { params }) {}". I found a post that referenced this work around and havent been able to find it again so I have no idea why it works. Using Next 13.4.3
@_anjianto
@_anjianto 11 ай бұрын
So, switching to app from pages currently is not worth it?
@brenol2177
@brenol2177 8 ай бұрын
What I also hate from nearly all javascript frameworks is that they change the architecture massively too quickly while also not updating entirely their documentations. They just documents the core main areas and the rest you have to find it out by yourself. So you need to keep rewriting your code all the time while also needing to keep shooting in the dark because there is no documentations.
@ShadowsPowerFy
@ShadowsPowerFy 11 ай бұрын
Make only the part that has the value a client component and rest server. Woulden't that fix it?
@daphenomenalz4100
@daphenomenalz4100 11 ай бұрын
Pls help, I am having a problem that in app router. Let's say i have a main page and a contact page, if i click on the link to the contact page in the main page and go back to main page by clicking on the link to the main page in there, it doesn't load. Why is this happening??:(
@nikhil182
@nikhil182 11 ай бұрын
I'm facing this caching problem with images which are stored inside /public. I have to rename the files to get updated images:(
@GeekOverdose
@GeekOverdose 11 ай бұрын
im just confused why they would announce the app directory as "production ready" or "stable" or whatever when it has so many issues still. another one I've been trying to battle is, you cannot access the full request object like you could with getServerSideProps. so you have to do weird hacky workarounds with middleware, which is just frustrating. Im gonna downgrade to next 12 for another year or so, until they iron out all the kinks.
@pasinduprabhashitha8752
@pasinduprabhashitha8752 11 ай бұрын
Another painful point I noticed was if we have created a API route inside the nextjs app and if we call to it inside a server component using fetch, we have to provide the absolute URL for that. Does this happen to anyone else?
@ravi_sorathiya
@ravi_sorathiya 11 ай бұрын
I think web dev cody also address this issue in his youtube short right josh?
@alext5497
@alext5497 11 ай бұрын
did you try to build and start ? is this just dev mode behavior?
@over1498
@over1498 11 ай бұрын
Can you just wrap it in a client component with a context provider? New context and it gets rerendered? Or am I defeating the purpose or something
@philheathslegalteam
@philheathslegalteam 11 ай бұрын
Has nothing to do with it unfortunately. This is a soft navigation issue because of Vercel’s refusal to give us granular control of client side router cache and navigations.
@nurihodges
@nurihodges 11 ай бұрын
hard navigation option for Link is something that should be introduced regardless if it is the fix for this particular issue or not
@ihoradamchuk2241
@ihoradamchuk2241 11 ай бұрын
I also had problems with caching. It is pretty annoying, especially if you are developing CRM. In my case, my data from prisma request was cached, like in your video. I used router.push() with option "forceOptimisticNavigation: true". It forces all requests in my RSC.
@nebularazer
@nebularazer 11 ай бұрын
Image me. Two days ago i first started using Next (switching from nuxt / vue) and i immediately ran into this problem. I spend 2 hours on this until i finally found the github issue and realized this is not a me problem. Hopefully this will be fixed soon. For now i keep working with next. Btw. the frontend link cache is not infinite it is 30 seconds - after that you get a real load. it is mentioned in the github issue
@codefork94
@codefork94 11 ай бұрын
@joshtriedcoding you should do a sveltekit v1 review 😮 would love to hear your thoughts and see some svelte content. Either way I still I rang that 🔔 icon and always look forward to your videos.
@shayantriedcoding
@shayantriedcoding 11 ай бұрын
Can you make a video on how to setup million js with next js 13 app directory
@xdaniels13
@xdaniels13 11 ай бұрын
Yes, I run into this problem, end up trying to look at my database, my fetching, all this other stuff. I was thinking I got a bug somewhere else no in Nextjs. I have to turn my page into a client component to fix it. Its a big of a let know as I was excting about using server components in some of my pages.
@algorithm-developer
@algorithm-developer 11 ай бұрын
Use next/navigation instead of next/link it will easily fix or create caching configuration for page
@rajeepthapa5426
@rajeepthapa5426 11 ай бұрын
I am too dumb to know what happen under the hood . I just know nextjs made my app faster. And I remember someone on stackoverflow told me always use next navigation
@aculz
@aculz 11 ай бұрын
Bro, next/navigation cant used on server side component, remember the main problem only happened when its a server side component. and server side component cannot using Hook. next/navigation is a hook so its mean its only can be used on client side component
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
Yeah, using the router from that package will even allow you a direct refresh method, with the caveat being this is only accessible client-side where this problem doesn't occur. If you take the exact example with Math.random() and the only change you make is turning this into a client component, no caching problems arise. Hence the workarounds wrapping these in client components. Good idea though. I hope there will be a more clear-cut solution. I linked a main GitHub issue for this in the description if you wanna be updated on the progress of this.
@omkararora
@omkararora 11 ай бұрын
Is anyone facing issues with loading.js not getting served? I click the Link tag and takes pretty long to redirect the page.
@amyIsFlexable
@amyIsFlexable 11 ай бұрын
The issue you ran into was you had a soft navigation back to your main page because Next, and you need to clear the React cache by using router.refresh() before you can get the change to show.
@iLiran
@iLiran 11 ай бұрын
Not to mention the insanely slow development mode. Next team are very ambitious, and I believe when they will stabilize Turbopack and the app router more, it will become much better experience.
@zachmcmullen4679
@zachmcmullen4679 11 ай бұрын
This is why I’ve stuck to client components and react query for data fetching in highly dynamic apps. Server components just don’t seem To support highly dynamic apps yet.
@wisdomelue
@wisdomelue 11 ай бұрын
some content outside of next.js will be great well done
@strawhatsanji4985
@strawhatsanji4985 11 ай бұрын
Hey great video as usual, quick question what is the technologies you need to study to actually launch a website/web app. Everyone always make videos about this new technology and another new technology. But what are the technologies need to start to launch an application to public. And what technologies can be learned after to enhance your knowledge.
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
You can launch an app with almost any technology. You can just use plain PHP, html and js and scale to tens of thousands of users. Just a question of what you like developing in
@strawhatsanji4985
@strawhatsanji4985 11 ай бұрын
@joshtriedcoding Yes thank you But I know the basics I am study Html css and Javascript. I will study react js after. Is that all needed to actually start a website/web app or do I need to learn other things. Also do I have to learn backend development to launch a website or app?
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
@@strawhatsanji4985 it really depends on what you'd like your app to do! If you'd need some sort of data persistence, yes you'd need some basic backend knowledge. But for simple apps, you can always use local storage, in the process also eliminating the need for various GDPR measures
@strawhatsanji4985
@strawhatsanji4985 11 ай бұрын
@@joshtriedcoding ok great thank you a lot. What backend framework do you suggest, Node Js? And what local storage would you suggest
@8bulletballers385
@8bulletballers385 11 ай бұрын
Can you please make a NextJS project tutorial where you integrate Express.JS in the backend 🤞🏽
@uzainmubarak9735
@uzainmubarak9735 11 ай бұрын
Don't you think useEffect will help?
@gsindar
@gsindar 11 ай бұрын
What about compulsory Image width and height nonsense? It's great pain with Tailwind.
@Arknoodle
@Arknoodle 11 ай бұрын
Next has had annoying caching behavior for awhile now. I can't count how many times I've had to delete the cache folder in the .next folder because it keeps using cached versions of images in my dev environment
@hamzaakhun
@hamzaakhun 10 ай бұрын
Another problem is static pages and serving Nextjs project on custom server. its been forced to use it only on vercel . we cant use some features such as dynamic routes for static pages . which we want to publish or server . we can deploy to server that support Nodejs .. so if its can be solved please make a video in which a Nextjs Application which dont use api route is deployed to a custom server as hostinger or aws. or heroku etc .
@yoni532s9M5w
@yoni532s9M5w 11 ай бұрын
I found it very hard to understand why I was using next js 13 at all. It's was at the time quite literally a budget dotnet mvc with little to none documentation.
@user-lq2ip9si7y
@user-lq2ip9si7y 11 ай бұрын
I personally think the pages router is perfect. They just need to add component level data fetching. They should also allow both getStaticProps and getServerSideProps on the same route. This should address majority of the everyday needs.
@qazyhn94
@qazyhn94 11 ай бұрын
thank you so much, i had this problem in my app when i tried App router recently, and i was just going crazy about it... i am still mad after so many days because this cached things for no reason and i had no idea (still have no idea) how to prevent this.. extremely sad for this to happen to nextjs without proper explanation
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
Just a really confusing decision for an app router marked as stable. I'm closely following the GitHub issue to see where this goes. The next team did acknowledge this as an important issue as far as I know
@ridass.7137
@ridass.7137 11 ай бұрын
isnt it called ISR (which you can disable)?
@runonce
@runonce 11 ай бұрын
I think ISR is a Pages router things. Here Josh is using the new App router.
@keremgozaydn2546
@keremgozaydn2546 11 ай бұрын
Even though the app directory is pretty innovating and improved, it's not production ready in my opinion. It is going to take a while to become a more viable choice than ssr or isr.
@tolotrarabefaly1333
@tolotrarabefaly1333 11 ай бұрын
What about router.refresh()?
@AutomaTrade
@AutomaTrade 11 ай бұрын
It seems to me that you are making wrong assumptions, since the page is requested from the server, it is cached locally, and with F5, it is fetched again, once loaded, the already loaded page is used if you need dynamic data you must place a component, with "use client" and this in turn will be dynamic, I believe that this cache has a gigantic power, but as we are talking about javascript on the server, it still finds some misconceptions, I could be wrong, but I am developing a new app in next 13 and when I came across this it became clear that pages generated on the server are static and if I need something dynamic I need components with the "use client"
@jonfroemming
@jonfroemming 11 ай бұрын
I use Remix so I'm fine, however each framework has its tradeoffs. For example in remix if you send a post request using axios the action function request does receive the data, but it can't redirect after, that is why we use useFetcher instead.
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
Yeah, amen for the trade-offs. Interesting behaviour from Remix
@jasongallavin2917
@jasongallavin2917 10 ай бұрын
I think this is more of a web thing than a remix thing. Ajax requests can't trigger redirects on the client unless the server tells the client to do so.
@mirsahib596
@mirsahib596 11 ай бұрын
The most frightening part is the issue is 9months old with about 200 comment on it and it's still not resolved
@philheathslegalteam
@philheathslegalteam 11 ай бұрын
This combined with 5 second wait for hot reload has made me switch entirely off Next. I just use Vite with generouted for file based routing and use Vercel CLI for api routes instead. 5 second hot reload down to 32 millisecond, AND I get nested routes. Go figure. The only unfortunate part is that you lose SSR, but building that with Vite plug-in SSR is trivial, or just use remix.
@um888
@um888 9 ай бұрын
Append the timestamp as a query parameter. This effectively creates a unique URL each time the code is executed, bypassing any caching mechanisms.
@MartinWawrusch
@MartinWawrusch 8 ай бұрын
Thumbs up - it's called cache busting and has been around forever. Lots of ways of dealing with cache issues on next 13, which is basically a v1 version.
@TariqSajid
@TariqSajid 11 ай бұрын
When You create nextjs build its .next directory size go above 3gb 😢😢😢😢 How someone can deploy this using rsync
@nested9301
@nested9301 11 ай бұрын
can u mention the issue in github
@AliCaliskan-km5jc
@AliCaliskan-km5jc 11 ай бұрын
Best content - thank you I learned a lot from you
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
So happy to hear that man. Thanks for commenting
@sarma_sarma
@sarma_sarma 11 ай бұрын
this is not only Josh if you add page transition using provider and framer motion you got infinity network call.
@boenrobot
@boenrobot 11 ай бұрын
I haven't tried this yet, but... What about useState() hook with the initial state being Math.Random or whatever data you want to be dynamic?
@Dhruv-kumar657
@Dhruv-kumar657 11 ай бұрын
you should join next js dev them... the would be happy. to have such talent as you
@jacobsfletch
@jacobsfletch 11 ай бұрын
Great video 👍
@logistics_guy
@logistics_guy 11 ай бұрын
That's why I love React-Query so badly!
@tomfancode
@tomfancode 11 ай бұрын
Yes, I asked this question at stackoverflow too. Still not having any good idea.
@vchap01
@vchap01 11 ай бұрын
It looks like a client cache issue. Try adding the "prefetch={false}" property to the "Link" component.
@jaeken
@jaeken 11 ай бұрын
that does not work
@grouby3850
@grouby3850 11 ай бұрын
For me the worst thing about next js 13 also is persisting values in zustand or redux. I can't find the best solution how to do it.
@alexchud
@alexchud 11 ай бұрын
You have to use cookies for server components
@DavidBowmanJr
@DavidBowmanJr 11 ай бұрын
With Next12, you could make a lot of architectural errors and the software would carry you, but this disabled us from using more modern React solutions like Fetch API / deduplication. Next13 functions more like a fullstack application with a clear distinction between server and client components. You're attempting to use a client-side feature in a server-side component. It's more of a problem with how you think about components, not an issue with Next itself. The issue with Next is they don't address these changes well in the documentation, and it's harder for people who've never done this stuff before.
@ozzyfromspace
@ozzyfromspace 11 ай бұрын
I agree! I'm using Next13 in prod and the best mental model I've come up with to keep data-flow sane is "the server is the source of the initial state of our data". Subsequent changes are best handled client-side, including requests for fresh data from the server.
@SonAyoD
@SonAyoD 11 ай бұрын
100% agree with the above, i have the same mental model.
@mma93067
@mma93067 10 ай бұрын
Looks like they’re relearning all the old lessons that laravel/Django went through ages ago. Time to go back to the drawing board
@reversetcp
@reversetcp 11 ай бұрын
Half build an app and im already considering learning svelte or nuxt
@joohyunglee1815
@joohyunglee1815 11 ай бұрын
I went with svelte!
@CaleMcCollough
@CaleMcCollough 11 ай бұрын
Hopefully, they fix this soon. Caching is great, but clearly, you need to be able to update the cache.
@codernerd7076
@codernerd7076 11 ай бұрын
This actually is a old PHP issue that got fixed in PHP they were not kidding when they were saying that Next.js turning in PHP 😂
@philheathslegalteam
@philheathslegalteam 11 ай бұрын
Josh keep in mind this is not a server issue its actually a client issue. The server behaves correctly. What happens here is what happens during pages dir for ssr as well. What you are experiencing is a soft navigation. I’ve been saying for months since app dir first previewed that we need enforceable client control over soft navigation. Next team has no comment.
@abdullafaizov7963
@abdullafaizov7963 11 ай бұрын
Thanks for pointing that out, I thought I am dumb and didn’t understand next js 13. caching in dev and in prod behaves differently
@thundergabriel
@thundergabriel 11 ай бұрын
NextJS 13 It´s hard for beginners. I'm keeping an eye Qwick
@kasvith
@kasvith 11 ай бұрын
Its slow... Oh lets cache everything
@MrKeliv
@MrKeliv 11 ай бұрын
In my opinion. Some user "cached page" and some user want "realtime page" asking. When cached page user asking 'Why this page always reloaded ??" When realtime user asking "Why this page not reloaded ??" I encountered this problem in ruby on rails when using Turbolink with datatable
@mounis
@mounis 11 ай бұрын
Time to move to svelte
@Zechey
@Zechey 11 ай бұрын
not sure if I should just keep my knowledge at react instead of advanced shit like next and learn svelte along with it
@wes337
@wes337 11 ай бұрын
Just don't use server components. Unless you create simple, boring, static websites. In all of my projects where I use Next, I inevitably start adding 'use client' to just about every single component. Because they all have some level of interactivity inside them. Next is great because I can easily have my front-end and back-end code in a single repository. But the fantasy of server components quickly goes out the window, once you start running into all the issues and complexity just to avoid showing a "spinner" (for the same amount of time it would take to load the server component itself). TLDR: server components sound great until you start using them in a real project
@joohyunglee1815
@joohyunglee1815 11 ай бұрын
Nextjs app directory is super frustrating. Things would work 5 times in a row, then not work. In development things would work fine but then in build mode everything breaks. I'm just going to learn Sveltekit
@romankoshchei
@romankoshchei 11 ай бұрын
And that's after Theo told everyone to use Nextjs, because it's stable
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
It is stable and awesome to develop in. This just really stuck out as something not-so-well-though-out.
@benjamismo
@benjamismo 11 ай бұрын
Théo is very biased tbh.
@romankoshchei
@romankoshchei 11 ай бұрын
I like Theo btw. He taught me a lot
@drverm
@drverm 11 ай бұрын
@@joshtriedcoding I find the middleware in App router to be quite odd and not-so-well-thought-out, will you do a video on this?
@romankoshchei
@romankoshchei 11 ай бұрын
@@joshtriedcoding So It should work fine with fetch?
@nested9301
@nested9301 11 ай бұрын
they suggest to use router.refresh() if u want an updated data when navigating
@CodeZakk
@CodeZakk 11 ай бұрын
Hi can you check it with page folder may be it solves that!!
@leo_dipp
@leo_dipp 11 ай бұрын
Yeah 😕 That's bug 42991 ... It's been around for months!!
@developer_hadi
@developer_hadi 11 ай бұрын
Why vercel doesn't just fix it
@edhahaz
@edhahaz 11 ай бұрын
This is fine :)
@user-xj6fp8mc1o
@user-xj6fp8mc1o 11 ай бұрын
i told you guys!!! I saw this coming a long time ago...
@walidmkw
@walidmkw 11 ай бұрын
This app router is fire, in all means. I really like how it works, but seriously there is so much problems. Actually in the doc they say to use server actions to handle forms, but it’s in alpha mode, and more over crash if you use generateStaticParams, so if you want SSG you’re basically fucked lol
@adarshaeth
@adarshaeth 11 ай бұрын
You are the real dev.
@user-on2rx4si7g
@user-on2rx4si7g 11 ай бұрын
Svelte is the best next for me so so bad I was using next since V10 I switched to svelte ❤
@nako0215
@nako0215 11 ай бұрын
I found myself a back-end engineer.
@repe0
@repe0 11 ай бұрын
I assume you are Running dev server?
@joshtriedcoding
@joshtriedcoding 11 ай бұрын
Even more aggressive caching on prod
@kyleroach2581
@kyleroach2581 11 ай бұрын
I’m of the opinion that SSR and all of its variants should have been truly everything is rendered on the server and not just parsed on the server and reconciled and committed on the client. If that makes sense. It’s turned into so many hacks. It should be all or nothing. Everything is rendered on the server literally and the client should merely reflect the state on the server. I get this raises a lot of debates. But that’s how I feel.
Let's Turn Beginner React Code Into Clean Code
16:35
Josh tried coding
Рет қаралды 77 М.
Don't Make These Next.js Mistakes
13:01
Dave Gray
Рет қаралды 21 М.
World’s Deadliest Obstacle Course!
28:25
MrBeast
Рет қаралды 90 МЛН
I Built a Shelter House For myself and Сat🐱📦🏠
00:35
TooTool
Рет қаралды 36 МЛН
ТАМАЕВ vs ВЕНГАЛБИ. ФИНАЛЬНАЯ ГОНКА! BMW M5 против CLS
47:36
Please be kind🙏
00:34
ISSEI / いっせい
Рет қаралды 88 МЛН
I DONT USE NEXT JS
54:01
ThePrimeTime
Рет қаралды 321 М.
What Next.js doesn't tell you about caching...
13:32
Marius Espejo
Рет қаралды 10 М.
How Did I Not Know This TypeScript Trick Earlier??!
9:11
Josh tried coding
Рет қаралды 203 М.
How NextJS REALLY Works
28:25
Theo - t3․gg
Рет қаралды 138 М.
Updates Like These Make Tailwind So Fun
8:00
Josh tried coding
Рет қаралды 71 М.
WTF Do These Even Mean
13:44
Web Dev Simplified
Рет қаралды 75 М.
The Four Levels of Caching in Next.js
25:48
Ankita Kulkarni
Рет қаралды 2,5 М.
React 19 has a Problem
7:43
Josh tried coding
Рет қаралды 20 М.
My Problem with Next.js Server Actions
10:13
James Q Quick
Рет қаралды 15 М.
Everyone's Making Fun of Next.js 14.0
7:16
Josh tried coding
Рет қаралды 133 М.
Разряженный iPhone может больше Android
0:34
i love you subscriber ♥️ #iphone #iphonefold #shortvideo
0:14
Si pamerR
Рет қаралды 3,6 МЛН
Mi primera placa con dios
0:12
Eyal mewing
Рет қаралды 719 М.
TOP-18 ФИШЕК iOS 18
17:09
Wylsacom
Рет қаралды 817 М.