Skip to content

Commit

Permalink
chore: update getting-started/react-essentials path (vercel#72250)
Browse files Browse the repository at this point in the history
## Description
At vercel#51579, react-essentials.mdx was deleted.
Some URLs doesn't navigate right pages due to this change.
Then I update to correct path.

- Fixes vercel#72566

---------

Co-authored-by: Sam Ko <[email protected]>
  • Loading branch information
JamBalaya56562 and samcx authored Nov 13, 2024
1 parent ebc3678 commit 3c3710b
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ fn report_error(app_dir: &Option<PathBuf>, filepath: &str, error_kind: RSCErrorK
RSCErrorKind::NextRscErrServerImport((source, span)) => {
let msg = match source.as_str() {
// If importing "react-dom/server", we should show a different error.
"react-dom/server" => "You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.\nLearn more: https://nextjs.org/docs/getting-started/react-essentials".to_string(),
"react-dom/server" => "You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.\nLearn more: https://nextjs.org/docs/app/building-your-application/rendering".to_string(),
// If importing "next/router", we should tell them to use "next/navigation".
"next/router" => r#"You have a Server Component that imports next/router. Use next/navigation instead.\nLearn more: https://nextjs.org/docs/app/api-reference/functions/use-router"#.to_string(),
_ => format!(r#"You're importing a component that imports {source}. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.\nLearn more: https://nextjs.org/docs/getting-started/react-essentials\n\n"#)
_ => format!(r#"You're importing a component that imports {source}. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.\nLearn more: https://nextjs.org/docs/app/building-your-application/rendering\n\n"#)
};

(msg, span)
Expand All @@ -270,29 +270,29 @@ fn report_error(app_dir: &Option<PathBuf>, filepath: &str, error_kind: RSCErrorK
.unwrap_or_default();

let msg = if !is_app_dir {
format!("You're importing a component that needs \"{source}\". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/getting-started/react-essentials#server-components\n\n")
format!("You're importing a component that needs \"{source}\". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-application/rendering/server-components\n\n")
} else {
format!("You're importing a component that needs \"{source}\". That only works in a Server Component but one of its parents is marked with \"use client\", so it's a Client Component.\nLearn more: https://nextjs.org/docs/getting-started/react-essentials\n\n")
format!("You're importing a component that needs \"{source}\". That only works in a Server Component but one of its parents is marked with \"use client\", so it's a Client Component.\nLearn more: https://nextjs.org/docs/app/building-your-application/rendering\n\n")
};
(msg, span)
}
RSCErrorKind::NextRscErrReactApi((source, span)) => {
let msg = if source == "Component" {
"You’re importing a class component. It only works in a Client Component but none of its parents are marked with \"use client\", so they're Server Components by default.\nLearn more: https://nextjs.org/docs/getting-started/react-essentials#client-components\n\n".to_string()
"You’re importing a class component. It only works in a Client Component but none of its parents are marked with \"use client\", so they're Server Components by default.\nLearn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components\n\n".to_string()
} else {
format!("You're importing a component that needs `{source}`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `\"use client\"` directive.\n\n Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components\n\n")
format!("You're importing a component that needs `{source}`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `\"use client\"` directive.\n\n Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client\n\n")
};

(msg,span)
},
RSCErrorKind::NextRscErrErrorFileServerComponent(span) => {
(
format!("{filepath} must be a Client Component. Add the \"use client\" directive the top of the file to resolve this issue.\nLearn more: https://nextjs.org/docs/getting-started/react-essentials#client-components\n\n"),
format!("{filepath} must be a Client Component. Add the \"use client\" directive the top of the file to resolve this issue.\nLearn more: https://nextjs.org/docs/app/api-reference/directives/use-client\n\n"),
span
)
},
RSCErrorKind::NextRscErrClientMetadataExport((source, span)) => {
(format!("You are attempting to export \"{source}\" from a component marked with \"use client\", which is disallowed. Either remove the export, or the \"use client\" directive. Read more: https://nextjs.org/docs/getting-started/react-essentials#the-use-client-directive\n\n"), span)
(format!("You are attempting to export \"{source}\" from a component marked with \"use client\", which is disallowed. Either remove the export, or the \"use client\" directive. Read more: https://nextjs.org/docs/app/api-reference/directives/use-client\n\n"), span)
},
RSCErrorKind::NextRscErrConflictMetadataExport(span) => (
"\"metadata\" and \"generateMetadata\" cannot be exported at the same time, please keep one of them. Read more: https://nextjs.org/docs/app/api-reference/file-conventions/metadata\n\n".to_string(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
x You're importing a component that needs "server-only". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/getting-started/
| react-essentials#server-components
x You're importing a component that needs "server-only". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-your-
| application/rendering/server-components
|
|
,-[input.js:9:1]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
x You're importing a component that imports client-only. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.\nLearn
| more: https://nextjs.org/docs/getting-started/react-essentials\n\n
| more: https://nextjs.org/docs/app/building-your-application/rendering\n\n
,-[input.js:9:1]
8 |
9 | import 'client-only'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
x You're importing a component that needs `useState`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:1:1]
Expand All @@ -9,7 +9,7 @@
`----
x You're importing a component that needs `createContext`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:3:1]
Expand All @@ -19,7 +19,7 @@
`----
x You're importing a component that needs `useEffect`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:5:1]
Expand All @@ -29,7 +29,7 @@
`----
x You're importing a component that needs `useImperativeHandle`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:5:1]
Expand All @@ -38,7 +38,7 @@
: ^^^^^^^^^^^^^^^^^^^
`----
x You’re importing a class component. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.
| Learn more: https://nextjs.org/docs/getting-started/react-essentials#client-components
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
|
|
,-[input.js:8:1]
Expand All @@ -49,7 +49,7 @@
`----
x You're importing a component that needs `createFactory`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:9:1]
Expand All @@ -60,7 +60,7 @@
`----
x You're importing a component that needs `PureComponent`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:10:1]
Expand All @@ -71,7 +71,7 @@
`----
x You're importing a component that needs `useDeferredValue`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:11:1]
Expand All @@ -82,7 +82,7 @@
`----
x You're importing a component that needs `useInsertionEffect`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:12:1]
Expand All @@ -93,7 +93,7 @@
`----
x You're importing a component that needs `useLayoutEffect`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:13:1]
Expand All @@ -104,7 +104,7 @@
`----
x You're importing a component that needs `useReducer`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:14:1]
Expand All @@ -115,7 +115,7 @@
`----
x You're importing a component that needs `useRef`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:15:1]
Expand All @@ -126,7 +126,7 @@
`----
x You're importing a component that needs `useSyncExternalStore`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:16:1]
Expand All @@ -137,7 +137,7 @@
`----
x You're importing a component that needs `experimental_useOptimistic`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:19:1]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
x You're importing a component that needs `flushSync`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:1:1]
Expand All @@ -9,7 +9,7 @@
`----
x You're importing a component that needs `unstable_batchedUpdates`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:1:1]
Expand All @@ -18,7 +18,7 @@
`----
x You're importing a component that needs `useActionState`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:3:1]
Expand All @@ -28,7 +28,7 @@
`----
x You're importing a component that needs `useFormStatus`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:5:1]
Expand All @@ -38,7 +38,7 @@
`----
x You're importing a component that needs `useFormState`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.
|
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering/client-components
| Learn more: https://nextjs.org/docs/app/api-reference/directives/use-client
|
|
,-[input.js:5:1]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
x You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.
| Learn more: https://nextjs.org/docs/getting-started/react-essentials
| Learn more: https://nextjs.org/docs/app/building-your-application/rendering
,-[input.js:9:1]
8 |
9 | import 'react-dom/server'
: ^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x You're importing a component that imports react-dom/client. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.
| \nLearn more: https://nextjs.org/docs/getting-started/react-essentials\n\n
| \nLearn more: https://nextjs.org/docs/app/building-your-application/rendering\n\n
,-[input.js:11:1]
10 |
11 | import 'react-dom/client'
Expand Down
Loading

0 comments on commit 3c3710b

Please sign in to comment.