mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-22 10:22:31 +01:00
fix react warning
This commit is contained in:
parent
3bc407cabd
commit
2830ec0e9b
@ -10,7 +10,9 @@ const BigWaveform = memo(({ waveforms, relevantTime, playing, durationSafe, zoom
|
||||
|
||||
const scaleFactor = zoom;
|
||||
|
||||
const [smoothTime, setSmoothTime] = useState(relevantTime);
|
||||
const [smoothTimeRaw, setSmoothTime] = useState(relevantTime);
|
||||
|
||||
const smoothTime = smoothTimeRaw ?? relevantTime;
|
||||
|
||||
const mouseDownRef = useRef();
|
||||
const containerRef = useRef();
|
||||
@ -47,8 +49,6 @@ const BigWaveform = memo(({ waveforms, relevantTime, playing, durationSafe, zoom
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
let time = relevantTime;
|
||||
setSmoothTime(time);
|
||||
const startTime = new Date().getTime();
|
||||
|
||||
if (playing) {
|
||||
@ -56,7 +56,6 @@ const BigWaveform = memo(({ waveforms, relevantTime, playing, durationSafe, zoom
|
||||
// eslint-disable-next-line no-inner-declarations
|
||||
function render() {
|
||||
raf = window.requestAnimationFrame(() => {
|
||||
time = new Date().getTime() / 1000;
|
||||
setSmoothTime(relevantTime + (new Date().getTime() - startTime) / 1000);
|
||||
render();
|
||||
});
|
||||
@ -66,6 +65,8 @@ const BigWaveform = memo(({ waveforms, relevantTime, playing, durationSafe, zoom
|
||||
return () => window.cancelAnimationFrame(raf);
|
||||
}
|
||||
|
||||
setSmoothTime(undefined);
|
||||
|
||||
return undefined;
|
||||
}, [relevantTime, playing]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user