<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: TechInnoLab</title>
    <description>The latest articles on DEV Community by TechInnoLab (@techinnolab).</description>
    <link>https://dev.to/techinnolab</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4259781%2Ff5a865e9-16de-45a9-a1a9-8e029990ca74.png</url>
      <title>DEV Community: TechInnoLab</title>
      <link>https://dev.to/techinnolab</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/techinnolab"/>
    <language>en</language>
    <item>
      <title>Building Responsive Layouts with Tailwind CSS Grid (and the auto-fill Trick I Wish I Knew Sooner)</title>
      <dc:creator>TechInnoLab</dc:creator>
      <pubDate>Mon, 23 Nov 2026 07:00:07 +0000</pubDate>
      <link>https://dev.to/techinnolab/building-responsive-layouts-with-tailwind-css-grid-and-the-auto-fill-trick-i-wish-i-knew-sooner-pi9</link>
      <guid>https://dev.to/techinnolab/building-responsive-layouts-with-tailwind-css-grid-and-the-auto-fill-trick-i-wish-i-knew-sooner-pi9</guid>
      <description>&lt;p&gt;I have a confession: for the first couple of years I wrote CSS professionally, I avoided Grid completely. Flexbox was my hammer, and every layout was a nail. Nested flex containers, negative margin hacks, &lt;code&gt;flex-basis: 33.333%&lt;/code&gt;. I made it all work, sort of. Then I opened the TechHub dashboard I was building on an actual tablet and watched my carefully nested flexbox layout fold into something that looked like a ransom note.&lt;/p&gt;

&lt;p&gt;That was the project that finally forced me to learn CSS Grid properly, through Tailwind's utilities. This post is more or less everything I wish someone had told me before I started.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Grid, and why through Tailwind
&lt;/h2&gt;

&lt;p&gt;Flexbox is one-dimensional. It's brilliant for a navbar, a button group, or centering an icon next to text. But the moment you're arranging content in two dimensions, rows and columns that need to stay in sync, flexbox makes you fight for it.&lt;/p&gt;

&lt;p&gt;Grid thinks in two dimensions natively. And Tailwind's grid utilities map almost one-to-one onto the CSS spec, so nothing you learn here is wasted. &lt;code&gt;grid-cols-3&lt;/code&gt; is just &lt;code&gt;grid-template-columns: repeat(3, minmax(0, 1fr))&lt;/code&gt; under the hood, so you can always drop back to raw CSS when you outgrow the utilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  The core utilities you'll actually use
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"rounded-xl border p-6"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;...&lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"rounded-xl border p-6"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;...&lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"rounded-xl border p-6"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;...&lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the pattern behind maybe 70% of the layouts on TechHub: one column on mobile, two on tablet, three on desktop, with &lt;code&gt;gap-6&lt;/code&gt; doing the spacing work that used to need margin gymnastics.&lt;/p&gt;

&lt;p&gt;The important mental shift: &lt;strong&gt;the gap belongs to the container, not the children.&lt;/strong&gt; No more &lt;code&gt;last:mr-0&lt;/code&gt; hacks, no more space utilities breaking the moment items wrap.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mobile first, always
&lt;/h2&gt;

&lt;p&gt;Every Tailwind breakpoint prefix is &lt;code&gt;min-width&lt;/code&gt;. &lt;code&gt;grid-cols-1 md:grid-cols-2&lt;/code&gt; means one column by default, two from 768px up. Write the phone layout as the unprefixed default and add columns as space appears.&lt;/p&gt;

&lt;h2&gt;
  
  
  The card grid (and where it broke)
&lt;/h2&gt;

&lt;p&gt;TechHub has a projects page: a grid of cards with a thumbnail, title, tags and stats. My first version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It looked great on my monitor. Then someone on a 1280px laptop said the cards looked squished. Four columns at &lt;code&gt;lg&lt;/code&gt; gave each card barely 280px. The fix I settled on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;auto-fill&lt;/code&gt; with &lt;code&gt;minmax&lt;/code&gt; tells the browser: fit as many 280px-minimum columns as you can, then stretch them to fill what's left. No breakpoints at all.&lt;/p&gt;

&lt;p&gt;One gotcha: &lt;code&gt;auto-fit&lt;/code&gt; collapses empty tracks, so with only two cards on a wide screen they stretch enormously. &lt;code&gt;auto-fill&lt;/code&gt; keeps the empty tracks, so cards stay a sane size. I got this backwards the first time and spent a while wondering why two lonely cards were each the width of a small country.&lt;/p&gt;

&lt;h2&gt;
  
  
  Spanning: the dashboard shell
&lt;/h2&gt;

&lt;p&gt;The brief: a stats row, a big chart, a sidebar of recent activity, and a full-width table. With flexbox this would have been three nested containers. With Grid it's one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"grid grid-cols-1 lg:grid-cols-3 gap-6"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- stats row: full width, its own inner grid --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"lg:col-span-3 grid grid-cols-2 lg:grid-cols-4 gap-4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;StatCard&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;StatCard&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;StatCard&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;StatCard&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

  &lt;span class="c"&gt;&amp;lt;!-- chart takes 2/3, activity feed takes 1/3 --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"lg:col-span-2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;...chart...&lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;aside&amp;gt;&lt;/span&gt;...recent activity...&lt;span class="nt"&gt;&amp;lt;/aside&amp;gt;&lt;/span&gt;

  &lt;span class="c"&gt;&amp;lt;!-- table spans everything --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"lg:col-span-3"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;...table...&lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On mobile everything stacks in source order. At &lt;code&gt;lg&lt;/code&gt; the spans kick in and it becomes the dashboard. One container, and the source order still makes sense for screen readers.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd actually do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Start with one column and add breakpoints only when the design actually breaks&lt;/strong&gt; in the browser, not when you think it might.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use auto-fill + minmax for card grids, breakpoint columns for page shells.&lt;/strong&gt; Content-driven sizing and design-driven sizing are different problems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't abandon flexbox.&lt;/strong&gt; Grid for the page, flex for the components inside it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Go easy on arbitrary values.&lt;/strong&gt; &lt;code&gt;gap-[13px]&lt;/code&gt; in a code review usually means the design hasn't been thought through.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resize the browser slowly across the whole range.&lt;/strong&gt; The bugs live between the breakpoints. My squished-card bug shipped because I only ever checked 375, 768 and 1440.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're flexboxing everything and quietly dreading two-dimensional layouts, pick one page and rebuild it with Grid. It'll feel awkward for about an hour, and then you'll wonder why you waited so long.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on the &lt;a href="https://techinnolab.com/blog/building-responsive-layouts-with-tailwind-css-grid" rel="noopener noreferrer"&gt;TechInnoLab blog&lt;/a&gt;. We're a small remote studio building &lt;a href="https://techinnolab.com/services/web-app-saas" rel="noopener noreferrer"&gt;web apps and SaaS dashboards&lt;/a&gt; for UK and EU businesses.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>tailwindcss</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Next.js 16.4: Cache Components, ensureStatic and a Security Patch You Shouldn't Skip</title>
      <dc:creator>TechInnoLab</dc:creator>
      <pubDate>Mon, 23 Nov 2026 06:27:11 +0000</pubDate>
      <link>https://dev.to/techinnolab/nextjs-164-cache-components-ensurestatic-and-a-security-patch-you-shouldnt-skip-nd</link>
      <guid>https://dev.to/techinnolab/nextjs-164-cache-components-ensurestatic-and-a-security-patch-you-shouldnt-skip-nd</guid>
      <description>&lt;p&gt;Next.js 16.4 landed on October 6, 2026, and it's the release where the Next.js team finally says it out loud: &lt;strong&gt;Cache Components is now the recommended model for every Next.js app.&lt;/strong&gt; New projects created with &lt;code&gt;create-next-app&lt;/code&gt; get it turned on by default, and it's set to become the default in Next.js 17.&lt;/p&gt;

&lt;p&gt;If you skipped the last few 16.x releases or you're still on the old implicit caching behaviour, this is the version worth paying attention to. Below I go through what changed, which features I think matter most for real projects, and how to upgrade safely, including the security patch you should not skip.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next.js 16.4 at a glance
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cache Components recommended for all apps and enabled by default in new projects&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ensureStatic&lt;/code&gt; to guarantee a route stays static&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;navigation()&lt;/code&gt; and &lt;code&gt;prefetch()&lt;/code&gt; to control what loads during a prefetch&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;next upgrade --agent&lt;/code&gt; for agent-driven upgrades&lt;/li&gt;
&lt;li&gt;Turbopack improvements: 20–25% smaller disk cache, lazy server HMR, a shared runtime chunk and smaller production bundles&lt;/li&gt;
&lt;li&gt;React 19.3 with stable View Transitions and Fragment Refs&lt;/li&gt;
&lt;li&gt;Experimental: faster Rust React Compiler, disk cache garbage collection, lazy dynamic imports, worker threads&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What are Cache Components, quickly?
&lt;/h2&gt;

&lt;p&gt;Cache Components replace the implicit caching from earlier App Router versions with something explicit. You mark a component or function with &lt;code&gt;'use cache'&lt;/code&gt; and choose how long it lives with &lt;code&gt;cacheLife()&lt;/code&gt;. Think of it as a Cache-Control header, but per component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;cacheLife&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'next/cache'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;Projects&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;userId&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="s1"&gt;'use cache'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;cacheLife&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'hours'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;projects&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;projects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findMany&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;eq&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;projectsTable&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;projects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One page can now mix a statically prerendered part, a cached part and a request-time part in the same response. To use the full model in an existing app, turn on two flags:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// next.config.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;NextConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'next'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;nextConfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;NextConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;cacheComponents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;partialPrefetching&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="n"&gt;nextConfig&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ensureStatic: keep your static pages static
&lt;/h2&gt;

&lt;p&gt;This is the feature I like most in this release. The flexibility of Cache Components has one risk: a single dynamic component, like a user avatar that reads cookies, can quietly turn a fully static page into one that renders on every request. That costs server time and money.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ensureStatic&lt;/code&gt; makes the build fail if that happens:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/blog/[slug]/page.tsx&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;ensureStatic&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'navigation'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;Page&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;UserAvatar&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* dynamic: this now fails the build */&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Content&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are three levels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;'navigation'&lt;/code&gt;: the strictest. Navigations to the route never render at request time.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'prefetch'&lt;/code&gt;: links with explicit prefetching only fetch static content.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;'shell'&lt;/code&gt;: only static content is fetched when the route is first discovered.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also export it from a layout, which applies the rule to every page under it. For blogs, marketing sites and e-commerce catalogue pages this is a cheap safety net.&lt;/p&gt;

&lt;h2&gt;
  
  
  navigation() and prefetch(): control what loads early
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Link prefetch&amp;gt;&lt;/code&gt; removes loading states, but it can also load far more data than anyone will look at. Think of an inbox: prefetching every visible message link would pull whole threads the user never opens.&lt;/p&gt;

&lt;p&gt;16.4 adds two functions from &lt;code&gt;next/cache&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;await navigation()&lt;/code&gt; excludes content from a prefetch and waits for a real navigation.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;await prefetch()&lt;/code&gt; excludes content from the route shell until an explicit prefetch happens.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;navigation&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'next/cache'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;Thread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;navigation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// skipped during prefetch&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;thread&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getThread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;thread&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wrap that component in &lt;code&gt;&amp;lt;Suspense&amp;gt;&lt;/code&gt; and the prefetch only carries what's above it. The rest loads when the user actually clicks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agent-driven upgrades with next upgrade --agent
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx next@canary upgrade --agent=latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command checks your installed version, picks a target, and hands your coding agent the migration guides, codemods and verification steps. There's also an &lt;code&gt;experimental.agentUpgrade&lt;/code&gt; config that reminds you during &lt;code&gt;next dev&lt;/code&gt; or &lt;code&gt;next build&lt;/code&gt; when an upgrade is available. The default policy is &lt;code&gt;'security'&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turbopack gains (no config needed)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Disk cache is 20–25% smaller thanks to Zstandard compression&lt;/li&gt;
&lt;li&gt;Lazy server HMR: editing a shared server module only recompiles what the current request needs&lt;/li&gt;
&lt;li&gt;A shared runtime chunk across routes for smaller downloads and better cache hits&lt;/li&gt;
&lt;li&gt;Smaller production bundles from shorter CSS Module class names and export name mangling&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Upgrade to 16.4.1, not 16.4.0
&lt;/h2&gt;

&lt;p&gt;On October 14, 2026, Next.js shipped an out-of-band security update. 16.4.1 fixes two critical RCE issues (one in &lt;code&gt;'use cache'&lt;/code&gt; functions, one in the Image Optimization API via sharp) and a DoS in App Router apps using Server Actions. On the 15.x line, the patched version is 15.5.28.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I'd upgrade
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Commit your work and create a branch.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;npm install next@16.4.1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;next build&lt;/code&gt; and fix any warnings.&lt;/li&gt;
&lt;li&gt;Turn on &lt;code&gt;cacheComponents&lt;/code&gt; and &lt;code&gt;partialPrefetching&lt;/code&gt; one section at a time, not all at once.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;ensureStatic&lt;/code&gt; to layouts that should never render dynamically, like your blog or docs.&lt;/li&gt;
&lt;li&gt;Test on staging, check Core Web Vitals and server usage, then deploy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For new projects, start on 16.4.1 with Cache Components on. For existing App Router apps, take the version bump now for the security fixes and move to Cache Components route by route.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post was originally published on the &lt;a href="https://techinnolab.com/blog/nextjs-16-4-whats-new-cache-components-upgrade-guide" rel="noopener noreferrer"&gt;TechInnoLab blog&lt;/a&gt;. We're a small remote studio building &lt;a href="https://techinnolab.com/services/web-development" rel="noopener noreferrer"&gt;Next.js and Laravel web apps&lt;/a&gt; for UK and EU businesses.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
