Replies: 502 suggested answers 1062 replies
{{editor}}'s edit
{{editor}}'s edit
-
For me, the one big remaining question is how to handle form POSTs in this new structure. My company has interaction with the server built around progressively enhanced form handling (currently using next-runtime to get a more Remix-like experience), and this is one of the things I was hoping would be front and center, but so far it seems to be conspicuously missing. |
Beta Was this translation helpful? Give feedback.
-
RE: On-demand Revalidation, there's a call out in Data Fetching > Revalidating Data, but it doesn't seem to appear listed elsewhere (nor on Roadmap). It'd be great to understand the plan for On-demand Revalidation on the Many thanks! |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
-
I have noticed that when working with layouts everything gets wrapped with a |
Beta Was this translation helpful? Give feedback.
-
Even if react StrictMode is turned off, useEffect is run 2 times in new app directory. |
Beta Was this translation helpful? Give feedback.
-
Attempting to use css modules in client components and the class names are applied but the css is not created, I am assuming (hoping) this is a bug. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
What was the reason to switch from If that's the case, I find it's really ugly to have a bunch of folders with just a |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
-
To keep focus on the other question thread specific to that question, I'm making a new comment for another question... If "Root Layout" is required and has |
Beta Was this translation helpful? Give feedback.
-
I can't wait for API Routes support in the |
Beta Was this translation helpful? Give feedback.
-
I am currently testing some stuff out in the take a look at screenshots app/layout.tsx code
app/page.tsx code
app/account/page.tsx code
app/movie/page.tsx code
|
Beta Was this translation helpful? Give feedback.
-
After little bit of trying,
|
Beta Was this translation helpful? Give feedback.
-
I use |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
-
I found a problem with CSS Modules, when I move |
Beta Was this translation helpful? Give feedback.
-
Creating a page at route |
Beta Was this translation helpful? Give feedback.
-
Hello, just tried to upgrade to next13 and turbopack on a project of mine (typescript, MUI) and I get this error: I don't have any reference of |
Beta Was this translation helpful? Give feedback.
-
Navigation between pages without rendering on the serverI am not sure if this is related to the new app directory but here we go: I just migrated a small size from pages to app directory and I've noticed a few things: My app is 100% a SPA. Yeah, I don't need SSR but I still love next DX and I am using api folder which is seamless to deploy fullstack apps, so I'd love to keep using next and don't move to a SPA or even build a SPA inside next. I'd like to keep it as a static component and next to treat is a client side component only and not do any logic in the server. Please see the image below that the paths are being SSR despite the root layout having a getStaticProps (I'd like to avoid SSR on ISR at all). I did try to use ISR with generateStaticParams which might improve a bit the UX as next would pre-render the page using the static params but my main question still: How can we use STATIC rendering when using the app directories and dynamic path parameters and delegate the client to render it? That request is making the user experience/navigation a bit strange as the user clicks and there is a 1 to 2 seconds delay because of the XHR request that fetches the page chunks/data:
Thanks |
Beta Was this translation helpful? Give feedback.
-
After the release of the 13.1.2, the font are broken for me, I think it's linked to : I was using a file import { Raleway } from '@next/font/google';
const raleway = Raleway({ subsets: ['latin'], preload: false });
export const getFontClassName = () => {
return raleway.className;
}; And now raleway.className is undefined, what should I change ? |
Beta Was this translation helpful? Give feedback.
-
Have any changes been made to next 13 based on user feedback? |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
-
in File Conventions Head every page head need import DefaultTags is a bad design, like viewport etc should write in app root directory like tags.jsx file, auto import every page, other head.jsx only update title or meta desicription, OR app root directory layout area not replace all, head tag maybe rename others /app/tags.jsx export default function Tags() {
return (
<>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
<link rel="icon" href="/favicon.ico" />
</>
)
} OR import './globals.css'
export default function RootLayout({ children }) {
return (
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
<link rel="icon" href="/favicon.ico" />
{/*
<head /> will contain the components returned by the nearest parent
head.jsx. Find out more at https://beta.nextjs.org/docs/api-reference/file-conventions/head
*/}
<head />
</head>
<body>{children}</body>
</html>
)
} |
Beta Was this translation helpful? Give feedback.
-
A system for de-duplicating non await prisma.user.findFirst({ where: {id: userId}}); 5 times, and thus hit the database 5 times per request (to populate all 5 server components). An example of how I would like this hypothetical API to work: await fetchData(() => prisma.user.findFirst({ where: { id: userId }}), `User-${userId}`); The secondary parameter is a tag which allows the de-duplication to work. The callback would only get run once and all calls to Such a solution would greatly improve the developer experience when using prisma. |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
-
Hello, I migrated the project I am doing for my master thesis in the area Software Engineering from Also thank you for already considering my feedback concerning While with version 13.1.2 this now works fine for a very simple scenario, there are navigation scenarios where the problem of Here is a screenshot of what a project where this problem occurrs might look like from the general navigation concept: Inside a Here is a Link to a corresponding issue I wrote: I also verified this problem with a very minimal amount of code. Here is a Link to the repository that allows the reproduction of this problem in a minimalistic example: Best regards, Michael |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
So I ran into issue where all I did was add experimental: {
appDir: true,
} into my Keep in mind I did not even create the |
Beta Was this translation helpful? Give feedback.
-
Hi, We are currently migrating our website to use the app directory and the initial experience is excellent. It scores a 100 on every metric and performance is much better and the best ever. I ran into trouble with internationalization where we want that en localization should not have the [lang] in the path name. For example:
Checked this example : https://github.com/vercel/next.js/tree/canary/examples/app-dir-i18n-routing and read https://beta.nextjs.org/docs/guides/internationalization but could not find how can i achieve the above since [lang] folder is below the app folder and all other folders under [lang] Could you provide any help ? Prashant |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
-
Question about how (if possible) to use Server components, fetch API and deduping together Working on a simplest MVP example from the boilerplate template and just trying to use:
Below I have an example of PostsFeed Server Component. It will use fetch to retrieve data from But I'm unable to run local build OR to deploy to Vercel. Because this means I need to supply production Even worse (I haven't tried it yet), I could try deploying bare application to production so that only How to solve this deployment issue using only single project/repository. (I'm looking at the marketing part -> Bring the power of full-stack to the frontend.) Seems that this scenario again calls for having separate FE and BE repos and deployments.
|
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
-
Recently stuck with adding shiki highlight into server components page file. |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
-
I have some strange problems. Do you have any temporary solutions to similar problems? warn - ./node_modules/postprocessing/build/postprocessing.js Import trace for requested module: |
Beta Was this translation helpful? Give feedback.
-
I have a Server Component inside |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
-
The API for segment-config is really not practical. More generally, having to export so many configuration constants independently is annoying because we can't really type each variable individually - it's just not something you want to do. Following the doc, I need to write this in my page: export const dynamic = 'auto';
export const dynamicParams = true;
export const revalidate = false;
export const fetchCache = 'auto';
export const runtime = 'nodejs';
export const preferredRegion = 'auto'; ...for which i loose all information of typing since we can't really type the module itself. I would assume somewhere in next.js there's something equivalent to: const defaults = {
dynamic: 'auto',
dynamicParams: true,
revalidate: false,
fetchCache: 'auto',
runtime: 'nodejs',
preferredRegion: 'auto',
}
const unsafeModule = await import(resolvedModulePath)
const safeModule = { ...defaults, ...unsafeModule } which makes me wonder why not rather just make one wrapper around all these options and call it type NextServerSidePageOptions = {
dynamic: 'auto' | 'force-dynamic' | 'error' | 'force-static',
dynamicParams: boolean,
revalidate: false | 'force-cache' | 0 | number,
fetchCache: // 'auto' | 'default-cache' | 'only-cache' | 'force-cache' | 'force-no-store' | 'default-no-store' | 'only-no-store',
runtime: 'experimental-edge' | 'nodejs',
preferredRegion: 'auto' | 'home' | 'edge' | 'string'
} ...which i could use as: import type { NextServerSidePageOptions } from 'next'
export const ssrPageOptions: Partial<NextServerSidePageOptions> = {
revalidate: true // type-error, finally
} This would be so much nicer |
Beta Was this translation helpful? Give feedback.
-
Does anyone have similar problem with Server Components always rendering twice (both in development build and production build). Because I'm trying data fetching with async/await pattern as first statement in Server Component and this rendering behaviour leads to external API endpoint being called twice as well. Using new react If I have: Also setting |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
-
Next.js 13 introduces the
app
directory (beta) with new features and conventions. However, upgrading to Next.js 13 does not require using the app directory.This discussion is where you can provide feedback on the new conventions and features around layouts, server components, streaming, and more.
If you have feedback on Turbopack, please use this discussion.
Beta Was this translation helpful? Give feedback.