-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
docs: adjust wording to reduce confusion in lifecycle section #32503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
WalkthroughThe documentation for the Nuxt lifecycle was updated to provide clearer and more detailed explanations of Step 6 and Step 7 in the server-side rendering process. Step 6 was renamed to "Render Page and Components," with expanded details about data fetching and the lack of server-side reactivity. A callout was added to emphasise that Vue's reactivity is paused during SSR. Step 7 was renamed to "Generate HTML Output," with refined descriptions of the HTML generation process and the addition of a tip linking to a related video. Existing warnings and callouts were retained. No code or public API changes were made. ✨ Finishing Touches🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
docs/2.guide/1.concepts/10.nuxt-lifecycle.md (4)
81-84
: Clarify lifecycle coverage and tighten wordingThe paragraph is clear but still suggests that no lifecycle hooks run on the server, which is technically inaccurate because
onServerPrefetch
(andsetup
itself) DO execute during SSR. While you’re touching these lines, you can also tighten the prose.-Nuxt renders the page and its components and fetches any required data with `useFetch` and `useAsyncData` during this step. Since there are no dynamic updates and no DOM operations occur on the server, Vue lifecycle hooks such as `onBeforeMount`, `onMounted`, and subsequent hooks are **NOT** executed during SSR. - -By default, Vue pauses dependency tracking during SSR for better performance. +Nuxt renders the page, its components, and fetches any required data with `useFetch` or `useAsyncData` during this step. Because no dynamic updates or DOM operations run on the server, client-only lifecycle hooks such as `onBeforeMount`, `onMounted`, and later hooks are **NOT** executed during SSR. (Server-specific hooks like `onServerPrefetch` still run.) + +By default, Vue temporarily pauses dependency tracking during SSR for better performance.
85-87
: Rephrase call-out for stronger accuracyThe current sentence is correct but a tad vague. Explicitly mentioning watchers/computed clarifies what “no reactivity” means.
-There is no reactivity on the server side because Vue SSR renders the app top-down as static HTML, making it impossible to go back and modify content that has already been rendered. +Vue’s effect system is disabled on the server: SSR renders the app top-down as static HTML, so watchers, computed setters, or any reactive updates cannot run after the initial render.
93-95
: Addrel="noopener"
for safer external linkOpening links in a new tab without
rel="noopener"
allows the new page to accesswindow.opener
. The docs elsewhere already use this pattern.-::tip{icon="i-lucide-video" to="https://youtu.be/dZSNW07sO-A" target="_blank"} +::tip{icon="i-lucide-video" to="https://youtu.be/dZSNW07sO-A" target="_blank" rel="noopener"}
99-100
: Polish wording of Step 7 explanationMinor verb-tense tweaks and a small terminology adjustment improve flow and precision.
-After all required data is fetched and the components are rendered, Nuxt combines the rendered components with settings from `unhead` to generate a complete HTML document. This HTML, along with the associated data, is then sent back to the client to complete the SSR process. +After all required data has been fetched and the components have been rendered, Nuxt merges the output with any `unhead` metadata to produce a complete HTML document. The document and its serialised state are then sent to the client, completing the SSR process.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/2.guide/1.concepts/10.nuxt-lifecycle.md
(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Tofandel
PR: nuxt/nuxt#0
File: :0-0
Timestamp: 2024-11-11T12:34:22.648Z
Learning: Ensure that AI-generated summaries accurately reflect the key changes in the PR, focusing on notable changes such as the removal of unused imports and variables starting with underscores.
Learnt from: huang-julien
PR: nuxt/nuxt#29366
File: packages/nuxt/src/app/components/nuxt-root.vue:16-19
Timestamp: 2024-12-12T12:36:34.871Z
Learning: In `packages/nuxt/src/app/components/nuxt-root.vue`, when optimizing bundle size by conditionally importing components based on route metadata, prefer using inline conditional imports like:
```js
const IsolatedPage = route?.meta?.isolate ? defineAsyncComponent(() => import('#build/isolated-page.mjs')) : null
```
instead of wrapping the import in a computed property or importing the component unconditionally.
Learnt from: GalacticHypernova
PR: nuxt/nuxt#26468
File: packages/nuxt/src/components/plugins/loader.ts:24-24
Timestamp: 2024-11-05T15:22:54.759Z
Learning: In `packages/nuxt/src/components/plugins/loader.ts`, the references to `resolve` and `distDir` are legacy code from before Nuxt used the new unplugin VFS and will be removed.
docs/2.guide/1.concepts/10.nuxt-lifecycle.md (1)
Learnt from: Tofandel
PR: nuxt/nuxt#0
File: :0-0
Timestamp: 2024-11-11T12:34:22.648Z
Learning: Ensure that AI-generated summaries accurately reflect the key changes in the PR, focusing on notable changes such as the removal of unused imports and variables starting with underscores.
🪛 LanguageTool
docs/2.guide/1.concepts/10.nuxt-lifecycle.md
[uncategorized] ~84-~84: Loose punctuation mark.
Context: ...ing during SSR for better performance. ::callout{icon="i-lucide-lightbulb"} Ther...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~86-~86: Loose punctuation mark.
Context: ...content that has already been rendered. :: ::important You should avoid code tha...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~88-~88: Loose punctuation mark.
Context: ...ent that has already been rendered. :: ::important You should avoid code that pr...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~90-~90: You might be missing the article “the” here.
Context: ...duces side effects that need cleanup in root scope of <script setup>
. An example o...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[uncategorized] ~90-~90: Possible missing comma found.
Context: ...with setInterval
. In client-side only code we may setup a timer and then tear it d...
(AI_HYDRA_LEO_MISSING_COMMA)
[grammar] ~90-~90: The word “setup” is a noun. The verb is spelled with a space.
Context: ...erval. In client-side only code we may setup a timer and then tear it down in
onBef...
(NOUN_VERB_CONFUSION)
[misspelling] ~90-~90: Did you mean “side effect” (=adverse effect, unintended consequence)? Open compounds are not hyphenated.
Context: ...round forever. To avoid this, move your side-effect code into onMounted
instead. :: ::ti...
(AFFECT_EFFECT)
[uncategorized] ~90-~90: Loose punctuation mark.
Context: ...e-effect code into onMounted
instead. :: ::tip{icon="i-lucide-video" to="https...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~92-~92: Loose punctuation mark.
Context: ...fect code into onMounted
instead. :: ::tip{icon="i-lucide-video" to="https://y...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~94-~94: Loose punctuation mark.
Context: ...ning Server Rendering and Global State. :: ### Step 7: Generate HTML Output Aft...
(UNLIKELY_OPENING_PUNCTUATION)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: lint-docs
thank you ❤️ |
🔗 Linked issue
Resolve #32303
📚 Description
This PR clarifies the wording in the Nuxt lifecycle documentation to make it easier to understand and reduce potential misunderstandings.
If there’s anything I may have overlooked, please feel free to let me know. Thank you very much!