Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hariombalhara committed May 17, 2023
1 parent c58717c commit 39c83d9
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ function RoutingForm({ form, profile, ...restProps }: Props) {
}

function getUrlSearchParamsToForward(response: Response, fields: NonNullable<Props["form"]["fields"]>) {
const paramsFromResponse: Record<string, string | string[]> = {};
const paramsFromCurrentUrl: Record<string, string | string[]> = {};
type Params = Record<string, string | string[]>;
const paramsFromResponse: Params = {};
const paramsFromCurrentUrl: Params = {};

// Build query params from response
Object.entries(response).forEach(([key, fieldResponse]) => {
Expand All @@ -202,11 +203,10 @@ function getUrlSearchParamsToForward(response: Response, fields: NonNullable<Pro
}
}

const allQueryParams: Record<string, string | string[]> = {
...paramsFromResponse,
// Make sure that all params initially provided are passed as is.
// In case of conflict b/w paramsFromResponse and pageParams, pageParams should win.
const allQueryParams: Params = {
...paramsFromCurrentUrl,
// In case of conflict b/w paramsFromResponse and paramsFromCurrentUrl, paramsFromResponse should win as the booker probably improved upon the prefilled value.
...paramsFromResponse,
};

const allQueryURLSearchParams = new URLSearchParams();
Expand Down

0 comments on commit 39c83d9

Please sign in to comment.