From 4a9837854bc3c9075765e23a95acd09d3584e210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Fri, 15 Nov 2024 15:06:42 +0100 Subject: [PATCH] pl-fe: fix media attachments reorder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-fe/src/reducers/compose.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/pl-fe/src/reducers/compose.ts b/packages/pl-fe/src/reducers/compose.ts index 090519f6c..124c25bbc 100644 --- a/packages/pl-fe/src/reducers/compose.ts +++ b/packages/pl-fe/src/reducers/compose.ts @@ -658,10 +658,10 @@ const compose = (state = initialState, action: ComposeAction | EventsAction | In case COMPOSE_CHANGE_MEDIA_ORDER: return updateCompose(state, action.composeId, compose => { const indexA = compose.media_attachments.findIndex(x => x.id === action.a); - const moveItem = compose.media_attachments[indexA]; const indexB = compose.media_attachments.findIndex(x => x.id === action.b); - compose.media_attachments = compose.media_attachments.splice(indexA, 1).splice(indexB, 0, moveItem); + const item = compose.media_attachments.splice(indexA, 1)[0]; + compose.media_attachments.splice(indexB, 0, item); }); case COMPOSE_ADD_SUGGESTED_QUOTE: return updateCompose(state, action.composeId, compose => {