File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
hello-world/react-hooks/src/components Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -53,12 +53,12 @@ function ImageCapture() {
5353 isDestroyed . current = false ;
5454
5555 // componentWillUnmount. dispose cvRouter when it's no longer needed
56- return async ( ) => {
56+ return ( ) => {
5757 isDestroyed . current = true ;
5858 if ( pCvRouter . current ) {
59- try {
60- ( await pCvRouter . current ) . dispose ( ) ;
61- } catch ( _ ) { }
59+ pCvRouter . current . then ( ( cvRouter ) => {
60+ cvRouter . dispose ( ) ;
61+ } ) . catch ( ( _ ) => { } )
6262 }
6363 } ;
6464 } , [ ] ) ;
Original file line number Diff line number Diff line change @@ -91,14 +91,13 @@ function VideoCapture() {
9191 } ) ( ) ;
9292
9393 // componentWillUnmount. dispose cvRouter when it's no longer needed
94- return async ( ) => {
94+ return ( ) => {
9595 isDestroyed = true ;
96- try {
97- // Wait for the pInit to complete before disposing resources.
98- await pInit ;
96+ // Wait for the pInit to complete before disposing resources.
97+ pInit . then ( ( ) => {
9998 cvRouter ?. dispose ( ) ;
10099 cameraEnhancer ?. dispose ( ) ;
101- } catch ( _ ) { }
100+ } ) . catch ( ( _ ) => { } )
102101 } ;
103102 } , [ ] ) ;
104103
You can’t perform that action at this time.
0 commit comments