mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 00:12:39 +00:00
18 lines
520 B
TypeScript
18 lines
520 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
import { useRouter } from "@/i18n/navigation";
|
|
|
|
/**
|
|
* Starts loading the mail view's code while the login form is on screen.
|
|
* Signing in pushes to it, and without this its scripts were only requested
|
|
* once the sign-in had finished, adding their download to every login.
|
|
*/
|
|
export function usePrefetchMailView(enabled: boolean): void {
|
|
const router = useRouter();
|
|
useEffect(() => {
|
|
if (!enabled) return;
|
|
router.prefetch("/");
|
|
}, [enabled, router]);
|
|
}
|