You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
📖 Documentation (updates to the documentation or readme)
🐞 Bug fix (a non-breaking change that fixes an issue)
👌 Enhancement (improving an existing functionality like performance)
✨ New feature (a non-breaking change that adds functionality)
⚠️ Breaking change (fix or feature that would cause existing functionality to change)
📚 Description
This PR lets queryCollection, queryCollectionNavigation, queryCollectionItemSurroundings and queryCollectionSearchSections take the event of a handler defined with defineEventHandler from nuxt/server, added in Nuxt 4.6. Today this fails typecheck since they only accept an H3Event. Same approach as atinux/nuxt-auth-utils#544 and nuxt-hub/core#937.
The event type is widened to H3Event | RequestEvent and the implementation still goes through h3, which works on Nitro 2 since the event a nuxt/server handler receives is a proxy over the h3 one. RequestEvent is declared in the module instead of imported because nuxt/server doesn't resolve below Nuxt 4.6. The basic fixture gets a nuxt/server route and a test checks it returns the same document as the h3 one.
I also tried the packed build in the Nuxt UI docs template with its raw markdown route moved to nuxt/server (nuxt-ui-templates/docs#354), it typechecks and serves the same markdown as the live site. Nuxt 5 is out of scope here, fetchContent still relies on event.$fetch and h3's getRequestHeaders.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
The server query APIs now accept ContentEvent, which includes H3Event and RequestEvent. A Nuxt server handler queries content and navigation. A test checks that the handler returns content matching the direct endpoint and includes a non-empty navigation array.
This adds nuxt/server handler events to the server query APIs as a type-level widening with a test. No concrete merge-blocking risk was identified. Nuxt 5 is not supported by this change.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description check
The description clearly explains the support for passing nuxt/server handler events to the content query APIs and matches the changeset.
Title check
The title clearly and concisely identifies the main change: support for nuxt/server events.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
❓ Type of change
📚 Description
This PR lets
queryCollection,queryCollectionNavigation,queryCollectionItemSurroundingsandqueryCollectionSearchSectionstake the event of a handler defined withdefineEventHandlerfromnuxt/server, added in Nuxt 4.6. Today this fails typecheck since they only accept anH3Event. Same approach as atinux/nuxt-auth-utils#544 and nuxt-hub/core#937.The event type is widened to
H3Event | RequestEventand the implementation still goes through h3, which works on Nitro 2 since the event anuxt/serverhandler receives is a proxy over the h3 one.RequestEventis declared in the module instead of imported becausenuxt/serverdoesn't resolve below Nuxt 4.6. The basic fixture gets anuxt/serverroute and a test checks it returns the same document as the h3 one.I also tried the packed build in the Nuxt UI docs template with its raw markdown route moved to
nuxt/server(nuxt-ui-templates/docs#354), it typechecks and serves the same markdown as the live site. Nuxt 5 is out of scope here,fetchContentstill relies onevent.$fetchand h3'sgetRequestHeaders.📝 Checklist