Skip to content

Commit

Permalink
Fix: Reset file index on new incomming props
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkoelle committed Nov 23, 2020
1 parent c833316 commit 3a8a2f8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/features/correction/MediaViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import ErrorIcon from '@material-ui/icons/Error';
import CropFreeIcon from '@material-ui/icons/CropFree';
import FolderOpenIcon from '@material-ui/icons/FolderOpen';
import OpenInNewIcon from '@material-ui/icons/OpenInNew';
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { shell } from 'electron';
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
import mime from 'mime-types';
Expand All @@ -40,6 +40,8 @@ export default function MediaViewer(props: any) {
const [rotation, setRotation] = useState(0);
const { files = [] } = props;

useEffect(() => setFileIndex(0), [files]);

const ZOOMSTEP = 20 / 100;
const ZOOMMIN = 40 / 100;
const ZOOMMAX = 500 / 100;
Expand Down

0 comments on commit 3a8a2f8

Please sign in to comment.