Skip to content

Commit 3e85556

Browse files
authored
Merge pull request #232 from sillsdev/TT-6981
TT-6981 wait for undo to complete
2 parents 204a958 + fea7316 commit 3e85556

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/renderer/src/components/WSAudioPlayer.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,14 +1097,14 @@ function WSAudioPlayer(props: IProps) {
10971097
};
10981098

10991099
const handleChanged = useCallback(async () => {
1100-
setChanged && setChanged(durationRef.current !== 0);
11011100
setBlobReady && setBlobReady(false);
11021101
wsBlob().then((newblob) => {
11031102
onBlobReady && onBlobReady(newblob);
11041103
setBlobReady && setBlobReady(newblob !== undefined);
11051104
if (setMimeType && newblob?.type) setMimeType(newblob?.type);
11061105
setDuration(wsDuration());
11071106
setProgress(wsPosition());
1107+
setChanged && setChanged(durationRef.current !== 0);
11081108
});
11091109
}, [
11101110
setChanged,
@@ -1163,8 +1163,9 @@ function WSAudioPlayer(props: IProps) {
11631163
});
11641164
};
11651165
const handleUndo = useCallback(() => {
1166-
wsUndo();
1167-
handleChanged();
1166+
wsUndo().then(() => {
1167+
handleChanged();
1168+
});
11681169
}, [wsUndo, handleChanged]);
11691170
useEffect(() => {
11701171
if (!controlsRef) return;

0 commit comments

Comments
 (0)