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

feat!: simplifyuseAsyncData() handler signature#33629

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
OrbisK wants to merge1 commit intonuxt:main
base:main
Choose a base branch
Loading
fromOrbisK:feat/async-data-handler

Conversation

@OrbisK
Copy link
Member

Caution

Breaking change

🔗 Linked issue

fixes#33623

📚 Description

This simplifies the usage foruseAsyncData handlers.

@bolt-new-by-stackblitz
Copy link

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

@coderabbitai
Copy link

coderabbitaibot commentedNov 1, 2025
edited
Loading

Walkthrough

The PR changes theAsyncDataHandler<ResT> signature from two positional parameters(nuxtApp, options: { signal }) to a single context object(context: { signal, nuxtApp }). Call sites in the async data composable, fetch composable and related tests have been updated to pass and destructure this single context object. Abort signal handling remains viacontext.signal. The public type export and documentation examples were updated to reflect the new handler shape.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Changes follow a consistent refactor pattern across multiple files (type, composables, tests).
  • Review should verify all call sites pass{ signal, nuxtApp } correctly and thatnuxtApp is extracted where needed (prerender/cache logic inasyncData.ts).
  • Confirm exportedAsyncDataHandler type and documentation examples are updated and consistent.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.You can run@coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Title Check✅ PassedThe pull request title "feat!: simplifyuseAsyncData() handler signature" is clear, concise, and directly related to the main change in the changeset. The title accurately captures the primary objective of refactoring the AsyncDataHandler signature from separate parameters to a single context object. It follows conventional commits format with the breaking change indicator (!), and avoids vague terminology or excessive detail. A developer scanning the history would immediately understand that this PR simplifies the useAsyncData handler interface.
Linked Issues Check✅ PassedThe code changes fully implement the objective specified in linked issue#33623. The AsyncDataHandler type signature has been updated from(nuxtApp: NuxtApp, options: { signal: AbortSignal }) to(context: { signal: AbortSignal, nuxtApp: NuxtApp }) across all relevant files. All internal call sites in asyncData.ts and fetch.ts have been updated to pass the new context object format, documentation examples have been revised, and tests have been updated accordingly. The implementation directly addresses the issue's requirement to simplify the handler signature by consolidating parameters into a single object.
Out of Scope Changes Check✅ PassedAll code changes are directly scoped to the objective of simplifying the AsyncDataHandler signature. The modifications span documentation (use-async-data.md), implementation files (asyncData.ts and fetch.ts), and tests (use-async-data.test.ts), with every change either updating the handler signature itself, adapting call sites to the new signature, or updating documentation and tests to reflect the change. No extraneous modifications or tangential improvements are present in the changeset.
Description Check✅ PassedThe pull request description is related to the changeset, stating that it "simplifies the usage foruseAsyncData handlers" and linking to the relevant issue#33623. Whilst minimal in detail, the description appropriately captures the intent of the changes and provides the necessary context linking to the GitHub issue. The description meets the lenient pass criteria for this check as it is clearly on-topic and describes a genuine aspect of the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between911b3cf and2e570fc.

📒 Files selected for processing (4)
  • docs/3.api/2.composables/use-async-data.md (7 hunks)
  • packages/nuxt/src/app/composables/asyncData.ts (3 hunks)
  • packages/nuxt/src/app/composables/fetch.ts (1 hunks)
  • test/nuxt/use-async-data.test.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/nuxt/src/app/composables/fetch.ts
  • docs/3.api/2.composables/use-async-data.md
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow standard TypeScript conventions and best practices

Files:

  • test/nuxt/use-async-data.test.ts
  • packages/nuxt/src/app/composables/asyncData.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Write unit tests for core functionality usingvitest

Files:

  • test/nuxt/use-async-data.test.ts
🧠 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:

  • test/nuxt/use-async-data.test.ts
  • packages/nuxt/src/app/composables/asyncData.ts
🧬 Code graph analysis (1)
packages/nuxt/src/app/composables/asyncData.ts (1)
packages/nuxt/src/app/nuxt.ts (1)
  • NuxtApp (199-199)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: code
🔇 Additional comments (7)
test/nuxt/use-async-data.test.ts (4)

955-969:LGTM: Handler signature correctly updated.

The test properly validates that the handler receives the signal in the context object and that it can be aborted viaclear().


1002-1027:LGTM: Signal merging test properly updated.

The handler correctly destructures the signal from the context object. The test validates that multiple abort signals can be merged, which is important for external cancellation scenarios.


1084-1104:LGTM: Dedupe cancellation with abort properly tested.

The handler correctly receives and uses the signal from the context object. The test validates that the first request is properly aborted whendedupe: 'cancel' is used.


1136-1155:LGTM: Clear abort behaviour correctly validated.

The handler properly destructures the signal from the context object and the test confirms that callingclear() triggers the abort signal, setting the status to idle.

packages/nuxt/src/app/composables/asyncData.ts (3)

20-20:Breaking change: Handler signature simplified.

The new signature consolidatesnuxtApp and the options object into a single context parameter, which aligns with the PR objectives to simplify the handler signature and facilitate signal integration.


651-662:LGTM: Prerender wrapper correctly updated.

The wrapper properly adapts to the new signature by accepting a singlectx parameter, destructuringnuxtApp for cache operations, and forwarding the complete context (includingsignal) to the underlying handler.


707-726:LGTM: Handler invocation correctly updated.

The handler is properly invoked with a single context object containing bothsignal (with merged abort signals including timeout) andnuxtApp. The implementation correctly handles abort scenarios before and during execution.


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.

@pkg-pr-new
Copy link

pkg-pr-newbot commentedNov 1, 2025
edited
Loading

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@33629

nuxt

npm i https://pkg.pr.new/nuxt@33629

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@33629

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@33629

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@33629

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@33629

commit:2e570fc

@OrbisKOrbisKforce-pushed thefeat/async-data-handler branch from911b3cf to2e570fcCompareNovember 1, 2025 22:16
@codspeed-hq
Copy link

CodSpeed Performance Report

Merging#33629 willnot alter performance

ComparingOrbisK:feat/async-data-handler (2e570fc) withmain (89f59b7)

Summary

✅ 10 untouched

Copy link
Member

@huang-julienhuang-julien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Let's use a future flag to make the breaking change for v5

@OrbisK
Copy link
MemberAuthor

OrbisK commentedNov 11, 2025
edited
Loading

Let's use a future flag to make the breaking change for v5

Can you help me with that? 😅

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

Reviewers

@huang-julienhuang-julienhuang-julien 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.

refactoruseAsyncData handler params

3 participants

@OrbisK@huang-julien@danielroe

[8]ページ先頭

©2009-2025 Movatter.jp