Skip to content

Conversation

@mwillbanks
Copy link
Contributor

@mwillbanks mwillbanks commented Nov 30, 2025

  • The standard way to access request query parameters is through ctx.query, not request.searchParams.
  • request.searchParams can be utilized but generally elysia utilizes ctx.query, unfortunately, they are not synchronized but ctx.query is generally where you would derive additional fields vs. request.searchParams.

Summary by CodeRabbit

  • Refactor
    • Improved internal query parameter handling in the server adapter for better efficiency.

✏️ Tip: You can customize this high-level summary in your review settings.

* The standard way to access request query parameters is through ctx.query, not request.searchParams.
* request.searchParams can be utilized but generally elysia utilizes ctx.query, unfortunately, they are not synchronized but ctx.query is generally where you would derive additional fields vs. request.searchParams.
Copilot AI review requested due to automatic review settings November 30, 2025 04:54
@coderabbitai
Copy link

coderabbitai bot commented Nov 30, 2025

Walkthrough

The Elysia handler refactors its context destructuring to include the query parameter directly from ctx.query, replacing the previous approach of constructing query parameters from URL searchParams. The overall handler logic and interface remain unchanged.

Changes

Cohort / File(s) Summary
Elysia Handler Refactoring
packages/server/src/adapter/elysia/handler.ts
Updated context destructuring to include query directly from ctx.query instead of parsing from URL searchParams; apiHandler.handleRequest continues to receive query data from the new source.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Single-file change: Verify that ctx.query provides the same data structure and values as the previous URL searchParams approach
  • Integration point: Confirm that the Elysia framework's ctx.query is reliable and properly populated across different request types

Poem

🐰 A query hops from URL's old way,
To ctx's direct embrace, hooray!
No parsing needed, sleek and fine,
The handler now finds query in line,
Simpler paths make code feel spry!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: switching from request.searchParams to ctx.query for accessing query parameters in the Elysia handler.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba08669 and 948cfe2.

📒 Files selected for processing (1)
  • packages/server/src/adapter/elysia/handler.ts (1 hunks)
⏰ 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). (3)
  • GitHub Check: Agent
  • GitHub Check: build-test (20.x, postgresql)
  • GitHub Check: build-test (20.x, sqlite)
🔇 Additional comments (1)
packages/server/src/adapter/elysia/handler.ts (1)

28-61: Good shift to ctx.query, but verify compatibility with apiHandler expectations

Using ctx.query directly is aligned with Elysia’s conventions and fixes the desync with request.searchParams. The only thing to double‑check is that the runtime/TS shape of ctx.query (e.g., parsed numbers/booleans, arrays, nested objects) still matches what options.apiHandler.handleRequest expects for its query parameter. If apiHandler assumes a plain Record<string, string | string[]>, you may want a small normalization step here or a tightened type to keep things consistent.


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 and usage tips.

Copilot finished reviewing on behalf of mwillbanks November 30, 2025 04:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Elysia adapter to use Elysia's idiomatic ctx.query for accessing query parameters instead of manually parsing request.searchParams. This aligns with Elysia's standard patterns and ensures query parameters are properly synchronized with the framework's context.

Key Changes:

  • Removed manual parsing of query parameters from url.searchParams
  • Now uses ctx.query directly from the Elysia context
  • Adjusted destructuring order to extract query from ctx alongside other context properties

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@ymc9 ymc9 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@ymc9 ymc9 merged commit c009246 into zenstackhq:dev Nov 30, 2025
11 of 12 checks passed
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