Skip to content

fix: preserve array query parameters in user redirect#29252

Draft
aayushbaluni wants to merge 1 commit intocalcom:mainfrom
aayushbaluni:fix/28687-query-string-arrays
Draft

fix: preserve array query parameters in user redirect#29252
aayushbaluni wants to merge 1 commit intocalcom:mainfrom
aayushbaluni:fix/28687-query-string-arrays

Conversation

@aayushbaluni
Copy link
Copy Markdown

Summary

When redirecting dynamic groups to /.../dynamic, the query string was built with URLSearchParams(context.query as Record<string, string>). Next.js passes string | string[] | undefined per key; array values were not serialized as repeated keys and broke multi-value params.

This change builds URLSearchParams by appending each value (and each array element) explicitly.

Fixes #28687.

Made with Cursor

Dynamic group redirects rebuilt the query string with
URLSearchParams(context.query as Record<string, string>), which coerced
string[] values incorrectly. Append each query value explicitly instead.

Fixes calcom#28687
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Welcome to Cal.diy, @aayushbaluni! Thanks for opening this pull request.

A few things to keep in mind:

  • This is Cal.diy, not Cal.com. Cal.diy is a community-driven, fully open-source fork of Cal.com licensed under MIT. Your changes here will be part of Cal.diy — they will not be deployed to the Cal.com production app.
  • Please review our Contributing Guidelines if you haven't already.
  • Make sure your PR title follows the Conventional Commits format.

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added the 🐛 bug Something isn't working label May 2, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1a5e334d-08c0-4d2b-bf59-4613febfad9e

📥 Commits

Reviewing files that changed from the base of the PR and between d278d6c and 82a0734.

📒 Files selected for processing (1)
  • apps/web/server/lib/[user]/getServerSideProps.ts

📝 Walkthrough

Walkthrough

The change modifies how query string parameters are preserved during redirects for dynamic groups. Instead of directly converting context.query into URLSearchParams, the code now iterates through query entries individually, appending array values separately and filtering out undefined values. This alters the serialization behavior for multi-valued query parameters and handles undefined values explicitly.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: preserve array query parameters in user redirect' directly and clearly describes the main change, which is fixing the handling of array query parameters in redirect logic.
Description check ✅ Passed The description explains the problem (incorrect serialization of array query parameters due to casting context.query), the solution (explicitly appending each value), and references the fixed issue #28687.
Linked Issues check ✅ Passed The pull request addresses all coding objectives from issue #28687: it modifies URLSearchParams construction to handle string | string[] | undefined values correctly, preserving repeated query parameters instead of serializing them as comma-separated values.
Out of Scope Changes check ✅ Passed The changes are focused on fixing the query parameter serialization in getServerSideProps, which is directly related to the stated objective of issue #28687 with no out-of-scope modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

Copy link
Copy Markdown
Member

@romitg2 romitg2 left a comment

Choose a reason for hiding this comment

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

mind adding video demo showing before fix and after fix behavior.

@romitg2 romitg2 marked this pull request as draft May 2, 2026 18:07
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Labels

🐛 bug Something isn't working size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect serialization of array query parameters in redirect logic

3 participants