From b4e641548cd255b90cf04eac93ca47d183169268 Mon Sep 17 00:00:00 2001 From: Rohitt Vashishtha Date: Wed, 28 Jun 2023 23:18:53 +0530 Subject: [PATCH] fix(web): Add m: to search query upon loading results. (#2954) Previously, we'd drop the m: from non-clip searches entirely. This behavior incorrectly represents the page's status (results from non-clip search but query implies a clip search). Also, any follow-up searches change to clip searches, which feels like a jarring UX if you have to add m: every time in a 'search-session'. --- web/src/routes/(user)/search/+page.svelte | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/src/routes/(user)/search/+page.svelte b/web/src/routes/(user)/search/+page.svelte index ce7585d715..69bffadde0 100644 --- a/web/src/routes/(user)/search/+page.svelte +++ b/web/src/routes/(user)/search/+page.svelte @@ -43,7 +43,14 @@ } }); - $: term = $page.url.searchParams.get('q') || data.term || ''; + $: term = (() => { + let term = $page.url.searchParams.get('q') || data.term || ''; + const isMetadataSearch = $page.url.searchParams.get('clip') === 'false'; + if (isMetadataSearch && term !== '') { + term = `m:${term}`; + } + return term; + })(); let selectedAssets: Set = new Set(); $: isMultiSelectionMode = selectedAssets.size > 0;