Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import {

import {CSVUtils} from '../utils/csv.js';
import {Toast} from '../utils/toast.js';
import {navigateToUrl} from '../utils/app-router.js';

const WEBSTATUS_FEATURE_OVERVIEW_CSV_FILENAME =
'webstatus-feature-overview.csv';
Expand Down Expand Up @@ -233,7 +234,7 @@ export class WebstatusOverviewFilters extends LitElement {
q: (this.typeaheadRef.value as WebstatusTypeahead).value,
start: 0,
});
window.location.href = newUrl;
navigateToUrl(newUrl);
}

protected firstUpdated(): void {
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/static/js/utils/app-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ export const navigateToUrl = (url: string, event?: MouseEvent) => {
return;
}

// Construct a full URL to handle relative paths correctly
const fullNewUrl = new URL(url, window.location.origin).href; // TODO for future - handle try/catch case until we use AppLocation

const currentUrl = window.location.href;
if (currentUrl === fullNewUrl) {
return;
}

// TODO. We should use the vaadin router and use the navigate method there.
window.location.href = url;
};
Expand Down
Loading