From 5683c07712b81cc2a8c1f494b3c901303bd2918c Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Mon, 13 Jan 2025 03:26:07 +0100 Subject: [PATCH] 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 --- src/modules/manga/components/MangaGrid.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/manga/components/MangaGrid.tsx b/src/modules/manga/components/MangaGrid.tsx index ca3234aa..5515c147 100644 --- a/src/modules/manga/components/MangaGrid.tsx +++ b/src/modules/manga/components/MangaGrid.tsx @@ -269,6 +269,10 @@ export const MangaGrid: React.FC = ({ // 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 = ({ }, [gridLayout]); useLayoutEffect( () => () => { + if (horizontal) { + return; + } + document.body.style.overflowY = 'auto'; }, [],