From 8cf9fd43227fba6d7f845f0a74e25446de2ec79d Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 13 Mar 2024 17:37:56 +0000 Subject: [PATCH 1/3] fix: Avoid crash by preventing quick src changes There is a bug with `react-native-video` that causes a crash if a video's `src` is changed quickly after setting it with some other value. Relevant GitHub discussion: https://github.com/wordpress-mobile/WordPress-iOS/issues/20882#issuecomment-1598228014 With this commit, we prevent the `src` from being quickly changed by not showing a video if it still has the `file:` protocol. --- packages/block-library/src/video/edit.native.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/video/edit.native.js b/packages/block-library/src/video/edit.native.js index ffa6c80d60569c..6ba7c83d21b3b0 100644 --- a/packages/block-library/src/video/edit.native.js +++ b/packages/block-library/src/video/edit.native.js @@ -290,6 +290,7 @@ class VideoEdit extends Component { } ) => { const showVideo = isURL( src ) && + getProtocol( attributes.src ) !== 'file:' && ! isUploadInProgress && ! isUploadFailed; const icon = this.getIcon( From ea55c9a3077bfc8c8715aecbc10fab8bb68269bd Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 13 Mar 2024 17:38:22 +0000 Subject: [PATCH 2/3] refactor: New line at end of const for readability --- packages/block-library/src/video/edit.native.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/video/edit.native.js b/packages/block-library/src/video/edit.native.js index 6ba7c83d21b3b0..f6960f0888617d 100644 --- a/packages/block-library/src/video/edit.native.js +++ b/packages/block-library/src/video/edit.native.js @@ -293,6 +293,7 @@ class VideoEdit extends Component { getProtocol( attributes.src ) !== 'file:' && ! isUploadInProgress && ! isUploadFailed; + const icon = this.getIcon( isUploadFailed ? ICON_TYPE.RETRY From fc139766daa5c48e559628763f998137b3a30729 Mon Sep 17 00:00:00 2001 From: Siobhan Date: Wed, 13 Mar 2024 17:41:33 +0000 Subject: [PATCH 3/3] docs: Add CHANGELOG entry --- packages/react-native-editor/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native-editor/CHANGELOG.md b/packages/react-native-editor/CHANGELOG.md index a7980626ac3946..70c636da4dccbd 100644 --- a/packages/react-native-editor/CHANGELOG.md +++ b/packages/react-native-editor/CHANGELOG.md @@ -14,6 +14,7 @@ For each user feature we should also add a importance categorization label to i - [*] Gallery block items with in-progress, paused, or failed media uploads correctly display an highlight outline when selected [#59423] - [**] [internal] Upgrade React Native to version 0.73.3 [#58475] - [**] Add error boundary components and exception logging [#59221] +- [**] Fix crash occurring when the URL associated with a Video block is changed too quickly [#59841] ## 1.114.1 - [**] Fix a crash produced when the content of a synced pattern is updated [#59632]