Skip to content

Commit

Permalink
🐛 preview: fix bug layout breaks when switch images quickly with arro…
Browse files Browse the repository at this point in the history
…w keys in preview (#492)
  • Loading branch information
lethemanh authored and shepilov committed Dec 16, 2024
1 parent 582d12c commit df5c472
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit df5c472

Please sign in to comment.