fix: preserve original router params in queued response handler #25373
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.
What does this PR do?
Fixes a bug in the headless router where URL parameters passed to
/router/embedwere being lost when the queued response was converted to a full response. This caused fields that were only present in the router URL (and not on the booking page) to be stored with empty values instead of their original values.Root Cause:
When using headless router with
cal.queueFormResponse=true, the flow is:/router/embed?xbc=312&...responseJSON/api/routing-forms/queued-responseFix:
The queued response handler now merges the original response with booking page params, preserving router-only fields while still allowing users to change values on the booking page.
How should this be tested?
Prerequisites:
label: "xbc", noidentifierproperty)Test Steps:
/router/embed?form={formId}&xbc=312&...(headless router URL)xbcfield hasvalue: "312"instead ofvalue: ""Expected behavior:
Visual Demo
N/A - This is a backend data storage fix with no UI changes.
Mandatory Tasks
Important Review Notes
No automated tests yet: I did not add tests for this fix. The smart friend advised writing tests first, but I proceeded with implementation. Tests should be added to verify:
xbc=312in URL but not on booking page)Type safety concern: Using
as FormResponsecast without validation. Consider adding proper JSON validation/parsing before casting.Merge logic heuristic: The fix uses "only override if non-empty" logic. This may not handle all edge cases correctly (e.g., what if a user intentionally wants to clear a field on the booking page?). The current logic would keep the original value instead of clearing it.
Potential breaking changes: Need to verify no other code paths depend on the current behavior of rebuilding responses from params only.
Not reproduced locally: I analyzed the code flow but did not reproduce the issue locally with logging to confirm the root cause.
Human reviewer should:
Link to Devin run: https://app.devin.ai/sessions/f4dc5b2b1ff14ecca758d469b097de1f
Requested by: [email protected] (@joeauyeung)
Checklist
Summary by cubic
Preserves original router URL params in headless router queued responses so router-only fields aren’t lost when saving form responses. Booking page changes still apply, but only non-empty values override the original.
Written for commit 38833c3. Summary will update automatically on new commits.