🐛 preview: fix bug layout breaks when switch images quickly with arrow keys in preview (#492)

This commit is contained in:
lethemanh
2024-12-16 11:40:33 +07:00
committed by Anton Shepilov
parent 582d12c462
commit df5c472d7b
@@ -66,8 +66,11 @@ export const DrivePreview: React.FC<DrivePreviewProps> = ({ 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 });