Skip to content

feat(server): accept nuxt/server events - #3890

Merged
farnabaz merged 1 commit into
mainfrom
feat/nuxt-server-events
Oct 20, 2026
Merged

farnabaz merged 1 commit into
mainfrom
feat/nuxt-server-events

Conversation

@benjamincanac

Copy link
Copy Markdown
Member

🔗 Linked issue

❓ Type of change

  • 📖 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.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
content Ready Ready Preview Oct 20, 2026 2:46pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e2e2ddda-ab96-44d0-a2b6-c28b82d4ed99
📥 Commits

Reviewing files that changed from the base of the PR and between 978fbc5 and 0dc20bb.

📒 Files selected for processing: 5
  • src/runtime/internal/event.ts
  • src/runtime/nitro.ts
  • src/runtime/server.ts
  • test/basic.test.ts
  • test/fixtures/basic/server/api/content/nuxt-server.get.ts

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.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Merge Risk: ⚪ Minimal · up to 0dc20

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: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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 Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description clearly explains the support for passing nuxt/server handler events to the content query APIs and matches the changeset.
Title check Passed The title clearly and concisely identifies the main change: support for nuxt/server events.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

❤️ Share

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 20, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/content@3890

commit: 0dc20bb

@farnabaz farnabaz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks

@farnabaz
farnabaz merged commit 3be36a6 into main Oct 20, 2026
9 checks passed
@farnabaz
farnabaz deleted the feat/nuxt-server-events branch October 20, 2026 15:05

This branch was successfully deployed

1 active deployment
Preview — 0dc20bbd Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants