File tree 2 files changed +12
-2
lines changed 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " react-email " : patch
3
+ ---
4
+
5
+ Pre-render email templates on hover
Original file line number Diff line number Diff line change 1
1
import * as Collapsible from '@radix-ui/react-collapsible' ;
2
2
import { AnimatePresence , LayoutGroup , motion } from 'framer-motion' ;
3
3
import Link from 'next/link' ;
4
- import { useSearchParams } from 'next/navigation' ;
4
+ import { useRouter , useSearchParams } from 'next/navigation' ;
5
5
import { cn } from '../../utils' ;
6
6
import type { EmailsDirectory } from '../../utils/get-emails-directory-metadata' ;
7
7
import { IconFile } from '../icons/icon-file' ;
@@ -14,6 +14,7 @@ export const FileTreeDirectoryChildren = (props: {
14
14
isRoot ?: boolean ;
15
15
} ) => {
16
16
const searchParams = useSearchParams ( ) ;
17
+ const router = useRouter ( ) ;
17
18
18
19
return (
19
20
< AnimatePresence initial = { false } >
@@ -71,7 +72,11 @@ export const FileTreeDirectoryChildren = (props: {
71
72
pathname : `/preview/${ emailSlug } ` ,
72
73
search : searchParams . toString ( ) ,
73
74
} }
74
- prefetch
75
+ onMouseOver = { ( ) => {
76
+ router . prefetch (
77
+ `/preview/${ emailSlug } ?${ searchParams . toString ( ) } ` ,
78
+ ) ;
79
+ } }
75
80
key = { emailSlug }
76
81
>
77
82
< motion . span
You can’t perform that action at this time.
0 commit comments