confirmed SSR support with Remix

This commit is contained in:
dswbx
2024-11-25 19:59:46 +01:00
parent 1c94777317
commit eea76ebc28
15 changed files with 144 additions and 44 deletions

View File

@@ -63,8 +63,15 @@ export function useNavigate() {
return [
(
url: string,
options?: { query?: object; absolute?: boolean; replace?: boolean; state?: any }
options?:
| { query?: object; absolute?: boolean; replace?: boolean; state?: any }
| { reload: true }
) => {
if (options && "reload" in options) {
window.location.href = url;
return;
}
const _url = options?.absolute ? `~/${basepath}${url}`.replace(/\/+/g, "/") : url;
navigate(options?.query ? withQuery(_url, options?.query) : _url, {
replace: options?.replace,