Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit c4e493e

Browse files
authored
Merge pull request #563 from heartexlabs/release/2.2.0
Release 2.2.0 (DEV-1324 DEV-2098)
2 parents 910a60c + 3864b3e commit c4e493e

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/components/Timeline/Views/Wave/Wave.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,13 @@ const useWaveSurfer = ({
414414
* Add region to wave
415415
*/
416416
wsi.on("region-created", (reg) => {
417+
const history = data.annotation?.history;
418+
419+
// if user draw new region the final state will be in `onUpdateEnd`
420+
// so we should skip history action in `addRegion`;
421+
// during annotation init this step will be rewritten at the end
422+
// during undo/redo this action will be skipped the same way
423+
history?.setSkipNextUndoState();
417424
const region = onAddRegion?.(reg);
418425

419426
if (!region) {

src/regions/AudioRegion.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,14 @@ const Model = types
8888
const color = Utils.Colors.convertToRGBA(self.getOneColor(), alpha);
8989
// eslint-disable-next-line no-unused-expressions
9090

91-
self._ws_region?.update({ color });
91+
try {
92+
self._ws_region?.update({ color });
93+
} catch {
94+
/**
95+
* Sometimes this method is called too soon in the new UI so it fails.
96+
* Will be good on the next execution
97+
* */
98+
}
9299
},
93100

94101
updateAppearenceFromState() {

src/stores/AnnotationStore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const Annotation = types
4747
parent_annotation: types.maybeNull(types.integer),
4848
last_annotation_history: types.maybeNull(types.integer),
4949

50-
loadedDate: types.optional(types.Date, new Date()),
50+
loadedDate: types.optional(types.Date, () => new Date()),
5151
leadTime: types.maybeNull(types.number),
5252

5353
// @todo use types.Date

0 commit comments

Comments
 (0)