Prevent "migrate dialog" from closing

Due to the scrollbar disappearing the dimension of the manga grid items changed which caused them to get unmounted and re-rendered again.
This then caused the dialog to get closed since the dialog is rendered in the manga grid item component
This commit is contained in:
schroda
2025-01-13 03:26:07 +01:00
parent 898fc6614f
commit 5683c07712

View File

@@ -269,6 +269,10 @@ export const MangaGrid: React.FC<IMangaGridProps> = ({
// always show vertical scrollbar to prevent https://github.com/Suwayomi/Suwayomi-WebUI/issues/758
useLayoutEffect(() => {
if (horizontal) {
return () => {};
}
// in case "overflow" is currently set to "hidden" that (most likely) means that a MUI modal is open and locks the scrollbar
// once this modal is closed MUI restores the previous "overflow" value, thus, reverting the just set "overflow" value
let timeout: NodeJS.Timeout;
@@ -291,6 +295,10 @@ export const MangaGrid: React.FC<IMangaGridProps> = ({
}, [gridLayout]);
useLayoutEffect(
() => () => {
if (horizontal) {
return;
}
document.body.style.overflowY = 'auto';
},
[],