I’m so hyped I decided to dig into the Next.js github repo, I found soke very fun new things :) Check out my Twitch, Twitter, Discord more at t3.gg S/O Ph4seOn3 for the awesome edit 🙏
Couldn't agree more. Next cache is really confusing sometimes or too opinionated, maybe. Idk. I'm letting the initial code without any cache config and fixing it as needed down the road.
Why we need so much abstraction for just a simple Cache-Control header. Cache-Control: max-age=10, stale-while-revalidate=20 Does after all this abstraction NextJS generate Cache-Control header like above that can be used by all CDN or some vercel specific magic 🪄. For on demand revaldation we should be able to declare our own revalidate function where we can send a API request to the CDN provider we are using to delete the cache. It will allow self host it without missing stale-while-revalidate feature.
Is it just me or does it seem like JS directives are being abused here? Maybe I'm missing something, but this "API" feels incredibly janky and in my opinion is likely indicative of an overall design flaw.
Pretty much every js framework abuses js syntax or just straight up adds new syntax or AST transformers to achieve what they want. I wish one of them would go all out and just make a new programming language already that's heavily based on js but actually has first-class support for the features they wanna add like components or reactive state. React came closest with jsx but it's still very half-baked because it's just sugar for createElement(element,props,children)
@@pokefreak2112 I'm not sure how active the development is, but I remember mint-lang was basically that, React concepts baked into a pretty declarative language. In any case, at the end of the day it's gonna be sugar for JS or sugar for WASM. The tricky part is making sure all the sugar is "standard" and works well in the language, and, well, random magic strings are probably not really great. It'd be nicer to have some sort of Next context object that you can set a flag to or call a method on, so then you didn't need a custom build step. But anyway... ship's sailed I guess.
@@pokefreak2112 See Flow. It has a component type and render type specifies. If you think creating a language is a good solution to what some people consider "bad API", then you're off the mark.
Guillermo doing a commit named “founder mode” on a demo app that is not even of a todolist complexity is sooooo cringe. Almost as cringe as Theo saying he is “leaking” and “reverse engineering” nexjs. And not as cringe as Vercel thinking that having less caching code is the way to fix the fact that they gave us not enough control.
Pretty great to see this. Finally they got caching right, you tell it where and how to cache something and it just does. I just hope there will be an eslint plugin to warn you of the things that error out in build, wouldn't mind getting a warning in the editor instead of waiting a few minutes just to get a 'pipeline failed' on github. Also great to see the cached async function at <a href="#" class="seekto" data-time="1460">24:20</a>, We can just make a function, return some JSX, and it all just works. Getting closer and closer to Dan Abramov's "just copy the code from client and paste it on the server" Now just waiting for GET server actions/functions and we'll be golden!
I think they know what they’re doing. They might not care or do it on purpose even? It gives some media buzz and people are more tolerant to bugs. Or what do you think?
Getting really into remix. There's a lot I don't like, but everything I don't like about remix is exactly the same things that I don't like about the app router in next.js. Although, this video highlights one of the exceptions.
I'm a fan of remix, but the lack of middleware is a nonstarter for me. So much copy-paste is required for simple things like authenticated route paths.
@@bruceleeharrison9284 Right now I'm just doing research. I'm trying to port our next.js app that makes heavy use of swr to see how that compares to porting the same project to the page router. Likely we'll keep using Next.js and the page router for a while, but it's fun to learn new things.
It's wild that they didn't do this from the start. Opt-in to caching, do not cache by default - and also differently in dev/prod. No wonder there was a lot of confused and annoyed developers.
Every time I heard "caching is hard" from other devs I was like "phew, you're overestimating it"... ...Then I implemented adaptive replacement cache for a filesystem one day and realised how annoying this thing is. Luckily I live in the EU where we don't have software patents, so I was free to just looked up a few US patents for filesystem caching, blatantly steal their ideas and figure out a good middleground.
I don't want to use nextjs anymore. because it has a big difference between development and production behavior and it's also pretty tightly bound to the vercel platform
Nah its fine, as long as they dont directly change how your backend behaves. they are only used by your frontend side maybe for some visuals, like managing the site theme or language, thats what I usually use them for
@@adamiscool1118 yea thats what I am using it for and cache non sensitive html (which is always sanitized using DOMPurify) view configs, because ultimately anything in the client is accessible no matter what so I came up with a way to cache state between history it’s pretty slick
Oof. At <a href="#" class="seekto" data-time="330">5:30</a> nobody told Theo that js is perfectly fine and is in general preferred over the jsx extension. Tsx is inescapable and most likely, Theo 's just been in TS land for so long that he assumed the same applies for vanilla js. This is the most charitable viewing of Theo's response I can come up with without doing crazy mental gymnastics