diff --git a/src/routes/Search/Search.js b/src/routes/Search/Search.js index 971caf2d2..45406150b 100644 --- a/src/routes/Search/Search.js +++ b/src/routes/Search/Search.js @@ -46,6 +46,8 @@ const Search = ({ queryParams }) => { : search.catalog_resources.map((catalog_resource, index) => { + const queryString = new URLSearchParams([['search', query]]).toString(); + const href = `#/discover/${encodeURIComponent(catalog_resource.request.base)}/${encodeURIComponent(catalog_resource.request.path.type_name)}/${encodeURIComponent(catalog_resource.request.path.id)}?${queryString}`; const title = `${catalog_resource.origin} - ${catalog_resource.request.path.id} ${catalog_resource.request.path.type_name}`; switch (catalog_resource.content.type) { case 'Ready': { @@ -56,7 +58,7 @@ const Search = ({ queryParams }) => { title={title} items={catalog_resource.content.content} itemComponent={MetaItem} - href={catalog_resource.href} + href={href} /> ); } @@ -68,7 +70,7 @@ const Search = ({ queryParams }) => { className={styles['search-row']} title={title} message={message} - href={catalog_resource.href} + href={href} /> ); } @@ -78,7 +80,7 @@ const Search = ({ queryParams }) => { key={index} className={styles['search-row']} title={title} - href={catalog_resource.href} + href={href} /> ); } diff --git a/src/routes/Search/useSearch.js b/src/routes/Search/useSearch.js index 9a4ad70ae..99f2d30a6 100644 --- a/src/routes/Search/useSearch.js +++ b/src/routes/Search/useSearch.js @@ -7,10 +7,6 @@ const initSearchState = () => ({ }); const mapSearchStateWithCtx = (search, ctx) => { - const queryString = search.selected !== null ? - new URLSearchParams(search.selected.extra).toString() - : - ''; const selected = search.selected; const catalog_resources = search.catalog_resources.map((catalog_resource) => { const request = catalog_resource.request; @@ -37,8 +33,7 @@ const mapSearchStateWithCtx = (search, ctx) => { return origin; }, catalog_resource.request.base); - const href = `#/discover/${encodeURIComponent(catalog_resource.request.base)}/${encodeURIComponent(catalog_resource.request.path.type_name)}/${encodeURIComponent(catalog_resource.request.path.id)}?${queryString}`; - return { request, content, origin, href }; + return { request, content, origin }; }); return { selected, catalog_resources }; };