Skip to content

Commit efd3532

Browse files
committed
Logic should be in utils, use new URL
1 parent 1dc9b69 commit efd3532

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

frontend/src/static/js/components/webstatus-overview-filters.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,10 @@ export class WebstatusOverviewFilters extends LitElement {
230230
};
231231

232232
gotoFilterQueryString(): void {
233-
const newUrl = `${window.location.origin}${formatOverviewPageUrl(
234-
this.location,
235-
{
236-
q: (this.typeaheadRef.value as WebstatusTypeahead).value,
237-
start: 0,
238-
},
239-
)}`;
233+
const newUrl = formatOverviewPageUrl(this.location, {
234+
q: (this.typeaheadRef.value as WebstatusTypeahead).value,
235+
start: 0,
236+
});
240237
navigateToUrl(newUrl);
241238
}
242239

frontend/src/static/js/utils/app-router.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ export const navigateToUrl = (url: string, event?: MouseEvent) => {
5555
return;
5656
}
5757

58+
// Construct a full URL to handle relative paths correctly
59+
const fullNewUrl = new URL(url, window.location.origin).href; // TODO for future - handle try/catch case until we use AppLocation
60+
5861
const currentUrl = window.location.href;
59-
if (currentUrl === url) {
62+
if (currentUrl === fullNewUrl) {
6063
return;
6164
}
6265

0 commit comments

Comments
 (0)