From df5c472d7b5fdcb15db23b5f8b16f327c9c7f861 Mon Sep 17 00:00:00 2001 From: lethemanh Date: Mon, 16 Dec 2024 11:40:33 +0700 Subject: [PATCH] :bug: preview: fix bug layout breaks when switch images quickly with arrow keys in preview (#492) --- .../frontend/src/app/views/client/viewer/drive-preview.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx b/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx index e98c194c..a68554f2 100644 --- a/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx +++ b/tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx @@ -66,8 +66,11 @@ export const DrivePreview: React.FC = ({ items }) => { if (items.length < 2) // eslint-disable-next-line @typescript-eslint/no-empty-function return () => {}; - addShortcut({ shortcut: 'Right', handler: handleSwitchRight }); - addShortcut({ shortcut: 'Left', handler: handleSwitchLeft }); + + if (!status.loading) { + addShortcut({ shortcut: 'Right', handler: handleSwitchRight }); + addShortcut({ shortcut: 'Left', handler: handleSwitchLeft }); + } return () => { removeShortcut({ shortcut: 'Right', handler: handleSwitchRight });