1
0
mirror of synced 2025-12-19 18:10:59 -05:00

[AI Search] minimum change to not persist search params (#55208)

This commit is contained in:
Ashish Keshan
2025-04-09 02:38:42 +09:00
committed by GitHub
parent 806775a2fb
commit dea38ff16a
3 changed files with 6 additions and 14 deletions

View File

@@ -123,9 +123,7 @@ test('open new search, and select a general search article', async ({ page }) =>
await page.keyboard.press('Enter')
// We should now be on the page for "For Playwright"
await expect(page).toHaveURL(
/\/get-started\/foo\/for-playwright\?search-overlay-input=serve\+playwright$/,
)
await expect(page).toHaveURL(/\/get-started\/foo\/for-playwright$/)
await expect(page).toHaveTitle(/For Playwright/)
})

View File

@@ -44,12 +44,6 @@ export const UnrenderedMarkdownContent = ({
if (existingURLParams.get('feature')) {
newParams.set('feature', existingURLParams.get('feature') || '')
}
if (existingURLParams.get('search-overlay-ask-ai')) {
newParams.set('search-overlay-ask-ai', existingURLParams.get('search-overlay-ask-ai') || '')
}
if (existingURLParams.get('search-overlay-input')) {
newParams.set('search-overlay-input', existingURLParams.get('search-overlay-input') || '')
}
// Combine new and existing query parameters
if (newParams.toString()) {
href = `${href}?${existingAnchorParams}&${newParams.toString()}`

View File

@@ -332,6 +332,9 @@ export function SearchOverlay({
if (searchParams.has('search-overlay-open')) {
searchParams.delete('search-overlay-open')
}
if (searchParams.has('search-overlay-input')) {
searchParams.delete('search-overlay-input')
}
router.push(`${selectedOption.url}?${searchParams.toString()}` || '')
onClose()
}
@@ -373,11 +376,8 @@ export function SearchOverlay({
eventGroupId: askAIEventGroupId.current,
})
setSelectedIndex(-1)
const searchParams = new URLSearchParams((router.query as Record<string, string>) || {})
if (searchParams.has('search-overlay-open')) {
searchParams.delete('search-overlay-open')
}
window.open(`${url}?${searchParams.toString()}` || '', '_blank')
// hardcode the feature to ai_search for now, delete when GA is ready
window.open(`${url}?feature=ai_search` || '', '_blank')
}
// Handle keyboard navigation of suggestions