NextJS 15
What's new ?
-
next.config.ts -> about time (still some ESM pkgs that are not supported) flag loggin can be set to true so that we know what is happenign on nextjs cache
-
Form Component Extension of the normal form that does prefetching and client-side navigation (on submit does client side transitions and shared layout - inmediate)
-
stable instrumentation.ts to monitor lifecycle of the server. Implemens
onRequestError
hook for capturing important context of errors thrown in the server like the server context (server component, action, handler, middleware) and sending it to an observability provider. Implementsregister
function taht runs code on app startup -
Advanced static generation controls for pages allowing to state retry counts, max concurrency and pages every worker can handle before spinnign a new one
-
Improved self-hosting allowing more control over caching
-
Middleware - Auth Checks Should not talk to the DB in the middleware we want it as close to where it shuld happen as possible. In the middleware we should be looking for verifying a cookie. Middleware actually runs on every route of the app (unless specified otherwise by the matcher)
- Interceptors
Complement to the middleware. Can do intercepts by certain routes ex(
/dashboard
, ...)
- Interceptors
Complement to the middleware. Can do intercepts by certain routes ex(
-
Fetches do not get cached by default But we still need to have an eye out for PPR as the page will be statistically generated then fetchs calls will generate the page with static data. Nextjs will try to prerender until the suspense boundaries. We can add
dynamicIO
as an experimental flag to enable alwasys dynamic IO and avoid the prerendering. With this falg we need to choose between the flag or suspense or cache We could also useuse cache
in order to force the cache on the page despite the flag. -
Params on client components Done through
use
hook that basically allows us to unwrap a promise in a client componet -
useFormState
now isuseActionState
. -
Added typed routes