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 = () => {
|
||||
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, []);
|
||||
|
||||
Reference in New Issue
Block a user