diff --git a/src/components/MangaGrid.tsx b/src/components/MangaGrid.tsx index 84a0133c..978dff63 100644 --- a/src/components/MangaGrid.tsx +++ b/src/components/MangaGrid.tsx @@ -223,7 +223,17 @@ export const MangaGrid: React.FC = (props) => { ); const updateGridWidth = () => { - setDimensions(gridRef.current?.offsetWidth ?? document.documentElement.offsetWidth); + const getDimensions = () => { + const gridWidth = gridRef.current?.offsetWidth; + + if (!gridWidth) { + return document.documentElement.offsetWidth; + } + + return gridWidth; + }; + + setDimensions(getDimensions()); }; useLayoutEffect(updateGridWidth, []); diff --git a/src/components/manga/ContinueReadingButton.tsx b/src/components/manga/ContinueReadingButton.tsx index ff831dd2..f30a536a 100644 --- a/src/components/manga/ContinueReadingButton.tsx +++ b/src/components/manga/ContinueReadingButton.tsx @@ -10,6 +10,8 @@ import { useTranslation } from 'react-i18next'; import { Button, Tooltip } from '@mui/material'; import PlayArrowIcon from '@mui/icons-material/PlayArrow'; +import { Link } from 'react-router-dom'; + export const ContinueReadingButton = ({ showContinueReadingButton, isLatestChapterRead, @@ -35,7 +37,8 @@ export const ContinueReadingButton = ({ variant="contained" size="small" sx={{ minWidth: 'unset' }} - href={`${mangaLinkTo}chapter/${nextChapterIndexToRead}`} + component={Link} + to={`${mangaLinkTo}chapter/${nextChapterIndexToRead}`} onClick={(e) => e.stopPropagation()} onMouseDown={(e) => e.stopPropagation()} >