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:
schroda
2023-12-28 16:07:50 +01:00
committed by GitHub
parent f12f025e9d
commit f81b20b4fd
2 changed files with 15 additions and 2 deletions

View File

@@ -223,7 +223,17 @@ export const MangaGrid: React.FC<IMangaGridProps> = (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, []);