1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-11-04 05:53:39 +03:00

Fix pathname when slide deck not in root

This commit is contained in:
Karl Horky 2021-06-17 12:10:30 +02:00 committed by GitHub
parent fc36f61881
commit 117e779388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,8 +38,9 @@ export default props => {
}, [index])
React.useEffect(() => {
if (props.location.pathname === '/print') return
props.navigate('/#' + index, {
const pathname = props.location.pathname
if (pathname === '/print') return
props.navigate(`${pathname}#${index}`, {
replace: true,
})
}, [index])