Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/nuxtPublic

docs: add parallel data fetching tip in best practices section#33815

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
martinszeltins wants to merge1 commit intonuxt:main
base:main
Choose a base branch
Loading
frommartinszeltins:docs/fetch-parallel-best-practice

Conversation

@martinszeltins
Copy link
Contributor

📚 Description

This PR adds a small section about how to avoid waterfall effect when you need to do multiple API calls. The suggestion is to usePromise.all to fetch in parallel to improve performance.

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz CodeflowRun & review this pull request inStackBlitz Codeflow.

@coderabbitai
Copy link

Walkthrough

The change adds documentation to the performance best practices guide. Specifically, it includes a code example demonstrating how to execute multiple API calls concurrently using Promise.all within useAsyncData, as an alternative to sequential request patterns. The documentation shows the implementation approach for parallel requests. No functional code changes or error-handling modifications are made. No public declarations are altered.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check nameStatusExplanation
Title check✅ PassedThe title accurately summarises the main change, which is adding documentation about parallel data fetching in the best practices section.
Description check✅ PassedThe description clearly relates to the changeset, explaining the purpose of adding guidance on using Promise.all to avoid waterfall effects in API calls.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

✨ Issue Enrichment is now available for GitHub issues!

CodeRabbit can now help you manage issues more effectively:

  • Duplicate Detection — Identify similar or duplicate issues
  • Related Issues & PRs — Find relevant issues and PR's from your repository
  • Suggested Assignees — Find the best person to work on the issue
  • Implementation Planning — Generate detailed coding plans for engineers and agents
Disable automatic issue enrichment

To disable automatic issue enrichment, add the following to your.coderabbit.yaml:

issue_enrichment:auto_enrich:enabled:false

Thanks for usingCodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment@coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitaicoderabbitaibot left a 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 (2)
docs/3.guide/2.best-practices/performance.md (2)

115-124:Consider showing how to destructure or access the returned data.

The example returns an array fromPromise.all, sodata will contain[products, shoes]. For clarity, you might want to show destructuring or accessing individual results:

const{ data}=awaituseAsyncData(()=>{returnPromise.all([$fetch("/api/products/"),$fetch("/api/category/shoes")]);});// data will be [productsArray, shoesArray]// Or destructure: const [products, shoes] = data.value

This helps readers understand the structure of the returned data immediately.


115-124:Document error-handling expectations for Promise.all.

While the example is correct, it's worth noting in the surrounding prose (or as an inline comment) that if any API call rejects, the entirePromise.all fails. For production code, consider mentioning alternatives likePromise.allSettled when partial failures are acceptable.

This addition strengthens the "best practices" aspect of the guide without complicating the basic example.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between2a91221 and9af5573.

📒 Files selected for processing (1)
  • docs/3.guide/2.best-practices/performance.md (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-10T14:42:56.647Z
Learnt from: TofandelRepo: nuxt/nuxt PR: 33192File: test/nuxt/use-async-data.test.ts:366-373Timestamp: 2025-09-10T14:42:56.647ZLearning: In the Nuxt useAsyncData test "should watch params deeply in a non synchronous way", the foo watcher intentionally updates both params.foo and params.locale using locale.value, simulating a scenario where one watcher consolidates multiple reactive values into a shared params object for testing debounced/non-synchronous behavior.

Applied to files:

  • docs/3.guide/2.best-practices/performance.md
🪛 LanguageTool
docs/3.guide/2.best-practices/performance.md

[uncategorized] ~125-~125: Loose punctuation mark.
Context: ..."/api/category/shoes") ]); }); ``` :read-more{title="Data fetching" to="/doc...

(UNLIKELY_OPENING_PUNCTUATION)

🔇 Additional comments (1)
docs/3.guide/2.best-practices/performance.md (1)

115-124:Code pattern is sound and well-placed.

The Promise.all pattern is the correct idiomatic approach for parallel requests in Nuxt, and the placement immediately after theuseFetch/useAsyncData explanation makes logical sense. The example is practical and concise.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

@danielroedanielroeAwaiting requested review from danielroedanielroe is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@martinszeltins

[8]ページ先頭

©2009-2025 Movatter.jp