Fix/library continue read button causes page refresh (#521)
* Use app routing to open reader Otherwise, the app loses the navigation history and won't open the last page (library) when closing the reader * Prevent setting 0 as grid width After the change of 4ebe6494f6c97c0d064c617f70b36682e6aedcb2, closing the reader and coming back to the library resulted in a single manga per row, due to the grids width being 0.
This commit is contained in:
@@ -223,7 +223,17 @@ export const MangaGrid: React.FC<IMangaGridProps> = (props) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const updateGridWidth = () => {
|
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, []);
|
useLayoutEffect(updateGridWidth, []);
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { Button, Tooltip } from '@mui/material';
|
import { Button, Tooltip } from '@mui/material';
|
||||||
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
|
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
|
||||||
|
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
export const ContinueReadingButton = ({
|
export const ContinueReadingButton = ({
|
||||||
showContinueReadingButton,
|
showContinueReadingButton,
|
||||||
isLatestChapterRead,
|
isLatestChapterRead,
|
||||||
@@ -35,7 +37,8 @@ export const ContinueReadingButton = ({
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
size="small"
|
size="small"
|
||||||
sx={{ minWidth: 'unset' }}
|
sx={{ minWidth: 'unset' }}
|
||||||
href={`${mangaLinkTo}chapter/${nextChapterIndexToRead}`}
|
component={Link}
|
||||||
|
to={`${mangaLinkTo}chapter/${nextChapterIndexToRead}`}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
onMouseDown={(e) => e.stopPropagation()}
|
onMouseDown={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user