From 94a7ef6318f5ce3932db741347ba399c2a5213bb Mon Sep 17 00:00:00 2001 From: Carlos Valente <34649812+cpvalente@users.noreply.github.com> Date: Tue, 7 Jun 2022 18:57:44 +0200 Subject: [PATCH] fix/141: enable applying negative delays (#142) --- .../editors/list/EventListWrapper.jsx | 31 +++---------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/client/src/features/editors/list/EventListWrapper.jsx b/client/src/features/editors/list/EventListWrapper.jsx index 3142d1e48..e1271ecfb 100644 --- a/client/src/features/editors/list/EventListWrapper.jsx +++ b/client/src/features/editors/list/EventListWrapper.jsx @@ -286,33 +286,10 @@ export default function EventListWrapper() { } break; case 'applyDelay': - // if delay <= 0 delete delay and next block - if (payload.duration <= 0) { - try { - // look for block after - let afterId = false; - let blockAfter = null; - for (const d of data) { - if (d.id === payload.id) afterId = true; - if (afterId && d.type === 'block') { - blockAfter = d.id; - break; - } - } - - // delete delay - await deleteEvent.mutateAsync(payload.id); - // delete block after, if any - if (blockAfter) await deleteEvent.mutateAsync(blockAfter); - } catch (error) { - emitError(`Error applying delay: ${error.message}`); - } - } else { - try { - await applyDelay.mutateAsync(payload.id); - } catch (error) { - emitError(`Error applying delay: ${error.message}`); - } + try { + await applyDelay.mutateAsync(payload.id); + } catch (error) { + emitError(`Error applying delay: ${error.message}`); } break;