This repository was archived by the owner on Apr 18, 2024. It is now read-only.
File tree 3 files changed +16
-2
lines changed
components/Timeline/Views/Wave
3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -414,6 +414,13 @@ const useWaveSurfer = ({
414
414
* Add region to wave
415
415
*/
416
416
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 ( ) ;
417
424
const region = onAddRegion ?.( reg ) ;
418
425
419
426
if ( ! region ) {
Original file line number Diff line number Diff line change @@ -88,7 +88,14 @@ const Model = types
88
88
const color = Utils . Colors . convertToRGBA ( self . getOneColor ( ) , alpha ) ;
89
89
// eslint-disable-next-line no-unused-expressions
90
90
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
+ }
92
99
} ,
93
100
94
101
updateAppearenceFromState ( ) {
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ const Annotation = types
47
47
parent_annotation : types . maybeNull ( types . integer ) ,
48
48
last_annotation_history : types . maybeNull ( types . integer ) ,
49
49
50
- loadedDate : types . optional ( types . Date , new Date ( ) ) ,
50
+ loadedDate : types . optional ( types . Date , ( ) => new Date ( ) ) ,
51
51
leadTime : types . maybeNull ( types . number ) ,
52
52
53
53
// @todo use types.Date
You can’t perform that action at this time.
0 commit comments