Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1760 from OpenBazaar/fixLostQueries
Browse files Browse the repository at this point in the history
don't wipe out query params
  • Loading branch information
jjeffryes authored Apr 29, 2019
2 parents 52aa0be + 22b5d4f commit fde4e05
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/views/search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,16 @@ export default class extends baseVw {
recordEvent('Discover_SearchFromAddressBar');
recordEvent('Discover_Search', { type: 'addressBar' });

let queryParams = (new URL(`${this.currentBaseUrl}?${options.query}`)).searchParams;
const queryParams = (new URL(`${this.currentBaseUrl}?${options.query}`)).searchParams;

// If the query had a providerQ parameter, use that as the provider URL instead.
if (queryParams.get('providerQ')) {
const subURL = new URL(queryParams.get('providerQ'));
queryParams = subURL.searchParams;
queryParams.delete('providerQ');
// The first parameter after the ? will be part of the providerQ, transfer it over.
for (const param of subURL.searchParams.entries()) {
queryParams.append(param[0], param[1]);
}
const base = `${subURL.origin}${subURL.pathname}`;
/*
If the query provider model doesn't already exist, create a new provider model for it.
Expand Down

0 comments on commit fde4e05

Please sign in to comment.