refactor
This commit is contained in:
parent
0b0455408f
commit
ebf15622e4
|
|
@ -49,7 +49,9 @@ export const HeaderView: React.FC<React.PropsWithChildren<{
|
|||
<form className='subnav-search' onSubmit={
|
||||
event => {
|
||||
event.preventDefault();
|
||||
navigate(filterText ? '#?' + new URLSearchParams({ q: filterText }) : '/');
|
||||
const url = new URL(window.location.href);
|
||||
url.hash = filterText ? '?' + new URLSearchParams({ q: filterText }) : '';
|
||||
navigate(url);
|
||||
}
|
||||
}>
|
||||
{icons.search()}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import './links.css';
|
|||
import { linkifyText } from '@web/renderUtils';
|
||||
import { clsx } from '@web/uiUtils';
|
||||
|
||||
export function navigate(href: string) {
|
||||
export function navigate(href: string | URL) {
|
||||
window.history.pushState({}, '', href);
|
||||
const navEvent = new PopStateEvent('popstate');
|
||||
window.dispatchEvent(navEvent);
|
||||
|
|
|
|||
Loading…
Reference in a new issue