episerver/foundation-lib-spa-core

Routing module ignores query parameters in links

pciarach opened this issue · 0 comments

In the EpiSpaRouter.tsx you created a navigation component with a global click handler. This handler subscribes to all links (a tags) and based on the URL, it either opens an external page or navigates to the internal page inside SPA.

The issue is that the logic responsible for SPA navigation takes into the account only path part of the URL thus ignoring any query parameters:

// Only act if we remain on the same domain
if (targetUrl.origin === currentUrl.origin) {
    newPath = targetUrl.pathname;
}

Query parameters might come in handy in many scenarios of SPA, so ignoring them seems to be quite of a problem.