From 6730bb3ceae96f7c2a329de34b3b7e3dbf8fb205 Mon Sep 17 00:00:00 2001 From: Muhammad Zain Tariq <49867382+mzaintariq@users.noreply.github.com> Date: Thu, 29 Jan 2026 15:39:26 +0500 Subject: [PATCH] fix pdp redirecting to search --- examples/core/src/lib/instantsearch-routing.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/core/src/lib/instantsearch-routing.ts b/examples/core/src/lib/instantsearch-routing.ts index 7941d876..8fbdbbb1 100644 --- a/examples/core/src/lib/instantsearch-routing.ts +++ b/examples/core/src/lib/instantsearch-routing.ts @@ -36,13 +36,17 @@ export function resolveInstantSearchRouting< createURL: ({ qsModule, routeState, location }) => { const { protocol, hostname, port = "", pathname, hash } = location; - const { node, ...otherRouteState } = routeState; const basePath = lang ? `/${lang}` : ""; - const currentUrlParams = urlToParams(location.toString()); const pathWithoutLang = basePath ? pathname.slice(basePath.length) : pathname; const match = pathWithoutLang.match(/^\/search(?:\/(.+))?$/); + if (!match) { + return location.href; + } + + const { node, ...otherRouteState } = routeState; + const currentUrlParams = urlToParams(location.toString()); const currentLocationNode = match && match[1] ? match[1].split("/").filter(Boolean).map(decodeURIComponent) : undefined;