kui-utils 0.0.16 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -2026,7 +2026,8 @@ var updateQueryParams = function (newLink) {
2026
2026
  var hrefLinkParams = newLink.split(/\?|&/);
2027
2027
  var hrefParams = Object.fromEntries(new URLSearchParams(hrefLinkParams.slice(1).join("&")).entries());
2028
2028
  var searchParams = Object.fromEntries(searchQuery.entries());
2029
- var route = hrefLinkParams[0];
2029
+ // @ts-ignore
2030
+ var route = searchQuery.size ? hrefLinkParams[0] : window.location.pathname;
2030
2031
  Object.keys(searchParams).forEach(function (key, index) {
2031
2032
  if (key in hrefParams) {
2032
2033
  searchParams[key] = hrefParams[key];
@@ -2037,7 +2038,8 @@ var updateQueryParams = function (newLink) {
2037
2038
  }
2038
2039
  });
2039
2040
  Object.keys(hrefParams).forEach(function (key) {
2040
- route += "&".concat(key, "=").concat(hrefParams[key]);
2041
+ // @ts-ignore
2042
+ route += "".concat(searchQuery.size ? "&" : "?").concat(key, "=").concat(hrefParams[key]);
2041
2043
  });
2042
2044
  window.history.pushState({ route: route }, "", route);
2043
2045
  };