Next.js fixes
The Next.js App Router errors you hit with component libraries and animated UI, reproduced and fixed with tested code.
- findDOMNode Is Not a Function in React 19: Find It, Fix It"findDOMNode is not a function" on React 19 means a dependency still calls ReactDOM.findDOMNode, which React 19 removed. Find the package in the stack trace (or grep node_modules), then replace it or patch it to read a ref. Pinning React 18 only works outside Next.js 15. Tested errors for seven popular old packages, with a replacement for each.Oct 26, 2026 · 6 min
- Toast Notifications After a Next.js Server Action (Sonner, useActionState, redirect)Return { ok, message } from the server action and toast in client code. Pass the action straight to useActionState and toast from useEffect so the form still works without JavaScript. Don't throw for user-facing errors: production shows Minified React error #441. After redirect(), pass the message in a short-lived cookie and reuse its toast id for any loading toast.Oct 21, 2026 · 7 min
- v0 to Production Next.js: What Breaks When You Turn Type Checking Back On97 of 121 public v0 projects set typescript.ignoreBuildErrors: true. Clone from v0's GitHub sync, run tsc --noEmit, turn the flag off, generate Supabase types instead of hand-writing them, set build-time env vars, pin "latest" deps and drop the dead eslint key on Next 16.Oct 21, 2026 · 7 min
- Stripe Elements With a Custom Card Design in React and Next.jsUse the split card Elements, not the Payment Element, if your card preview should show the brand and flip for the CVC. Your page never sees the digits, so show dots. Track complete for number, expiry and CVC separately, style with the style object, and create the Stripe client inside the route handler so next build works without the key.Oct 21, 2026 · 6 min
- Fix "Failed to find Server Action" in Next.js After a DeployEvery next build gives each Server Action a new id unless NEXT_SERVER_ACTIONS_ENCRYPTION_KEY is set, so a page left open across a deploy posts a stale id, gets a 409 and shows Next's error screen. Set the key where next build runs and the id stays the same across builds. For login, sign-up and checkout, a route handler form has no id to go stale.Oct 21, 2026 · 6 min
- shadcn Sidebar Icon Rail in Next.js: Keep the Collapsed State With a Cookieshadcn's Sidebar writes a sidebar_state cookie on every toggle but never reads it. Read it with cookies() in a route group layout and pass defaultOpen, treating a missing cookie as open. On a new Next.js 16 app, Cache Components is on, so move the cookie read into a child component wrapped in Suspense or the build fails.Oct 21, 2026 · 6 min
- Radix Dialog Leaves pointer-events: none on the Body? Here's the FixRadix sets pointer-events: none on the body while a modal is open. If it stays after closing, check npm ls @radix-ui/react-dismissable-layer for two versions. Two copies restore the wrong value. Dedupe with radix-ui or an npm override, or set modal={false} on the dropdown that opens the dialog.Oct 21, 2026 · 6 min
- Command Palette in React and Next.js: Cmd+K with cmdk, Done RightUse cmdk inside a Radix dialog, mounted once in the root layout. Listen for Cmd or Ctrl plus K and call preventDefault, add a hidden Dialog.Title, hand focus back when the dialog closes, reset the query on every close, and mark server results forceMount so cmdk doesn't filter them away.Oct 21, 2026 · 5 min
- Next.js File Upload: Server Actions, Progress Bars and the 1 MB LimitServer actions take files but stop at 1 MB by default and report no progress. For a progress bar, send the file with XMLHttpRequest to a route handler and read xhr.upload.onprogress. If you have a proxy.ts, keep the upload route out of its matcher or raise proxyClientMaxBodySize, or bodies over 10 MB get cut off.Oct 21, 2026 · 5 min
- Fix the Dark Mode Flash in Next.js (Tailwind v4, No Library)The server can't read localStorage, so it renders light HTML and the page flips after React loads. Put a small inline script in <head> that sets the dark class on <html> before the first paint, add suppressHydrationWarning to <html>, and switch Tailwind v4's dark variant to a class with @custom-variant.Oct 21, 2026 · 6 min
- OTP Input in React: Paste, Autofill and one-time-code That WorkUse one real input with autocomplete="one-time-code", inputMode="numeric" and no maxLength, drawn as six boxes. Filter to digits and slice in onChange so a pasted "123-456" keeps all six digits, and call onComplete from an effect so the form submits the clean value.Oct 21, 2026 · 6 min
- overscroll-behavior contain: Stop Scroll Stealing in Reactoverscroll-behavior: contain stops scroll from chaining to the page once a scroll container hits its edge, so use it on drawers and modal lists. On a horizontal table or carousel use overscroll-behavior-x: contain only, keep the height natural, and drop wheel handlers that call preventDefault.Oct 16, 2026 · 8 min
- useSyncExternalStore getServerSnapshot: Next.js FixuseSyncExternalStore needs a third argument, getServerSnapshot, whenever Next.js renders the component on the server, which includes client components on static routes. Without it next build fails with "Missing getServerSnapshot". Return a constant default such as false or true, and React swaps in the real browser value after hydration.Oct 14, 2026 · 8 min
- Next.js Hydration Error from Dates: 5 Tested FixesA Next.js hydration error from dates happens because a client component renders on the server and again in the browser, and new Date(), toLocaleString() or Math.random() return different text each time. Fix it by formatting on the server with a pinned time zone, filling the value in after mount, or skipping SSR for that widget.Oct 12, 2026 · 9 min
- "use client" Error in Next.js: useState, Context, onClickA "use client" error in Next.js means a Server Component imported code that needs the browser: a hook, createContext or an event handler. Add "use client" to that component's file, or re-export a third-party component from your own client wrapper, keep page.tsx a Server Component, and pass only serializable props.Oct 1, 2026 · 8 min