(name: string)
| 2026 | }) |
| 2027 | |
| 2028 | const useModal = (name: string) => { |
| 2029 | const currentOpen = postRoute.useSearch({ |
| 2030 | select: (search) => search[`_${name}`], |
| 2031 | }) |
| 2032 | |
| 2033 | const navigate = useNavigate() |
| 2034 | |
| 2035 | const setModal = (open: boolean) => { |
| 2036 | navigate({ |
| 2037 | to: '.', |
| 2038 | search: (prev: {}) => ({ |
| 2039 | ...prev, |
| 2040 | [`_${name}`]: open ? true : undefined, |
| 2041 | }), |
| 2042 | resetScroll: false, |
| 2043 | }) |
| 2044 | } |
| 2045 | |
| 2046 | return [currentOpen, setModal] as const |
| 2047 | } |
| 2048 | |
| 2049 | function DetailComponent(props: { id: string }) { |
| 2050 | const params = useParams({ strict: false }) |
no test coverage detected