From 411d4f053c1a6765112d344bcb98e15d0f35eaf5 Mon Sep 17 00:00:00 2001
From: vladislavkeblysh <138868841+vladislavkeblysh@users.noreply.github.com>
Date: Wed, 15 Oct 2025 19:47:03 +0300
Subject: [PATCH] fix: fixed delete for additional video url fields in video
editor (#2470)
---
.../components/VideoSourceWidget/hooks.jsx | 10 ++++------
.../components/VideoSourceWidget/index.jsx | 6 +++---
.../components/VideoSourceWidget/index.test.tsx | 2 +-
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/hooks.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/hooks.jsx
index a527e3404..8401967e5 100644
--- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/hooks.jsx
+++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/hooks.jsx
@@ -39,16 +39,14 @@ export const sourceHooks = ({ dispatch, previousVideoId, setAlert }) => ({
export const fallbackHooks = ({ fallbackVideos, dispatch }) => ({
addFallbackVideo: () => dispatch(actions.video.updateField({ fallbackVideos: [...fallbackVideos, ''] })),
+
/**
* Deletes the first occurrence of the given videoUrl from the fallbackVideos list
* @param {string} videoUrl - the video URL to delete
*/
- deleteFallbackVideo: (videoUrl) => {
- const index = fallbackVideos.findIndex(video => video === videoUrl);
- const updatedFallbackVideos = [
- ...fallbackVideos.slice(0, index),
- ...fallbackVideos.slice(index + 1),
- ];
+ deleteFallbackVideo: (videoIndex) => {
+ const updatedFallbackVideos = fallbackVideos.toSpliced(videoIndex, 1);
+
dispatch(actions.video.updateField({ fallbackVideos: updatedFallbackVideos }));
},
});
diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/index.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/index.jsx
index b1a85a940..dbf0c3a55 100644
--- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/index.jsx
+++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/index.jsx
@@ -98,7 +98,8 @@ const VideoSourceWidget = () => {