diff --git a/client/src/features/editors/list/EventListWrapper.jsx b/client/src/features/editors/list/EventListWrapper.jsx index 3bcfc46e5..92de1508b 100644 --- a/client/src/features/editors/list/EventListWrapper.jsx +++ b/client/src/features/editors/list/EventListWrapper.jsx @@ -30,10 +30,13 @@ export default function EventListWrapper() { const previousEvents = queryClient.getQueryData(eventsNamespace); // optimistically update object, temp ID until refetch - queryClient.setQueryData(eventsNamespace, (old) => [ - ...old, - { ...newEvent, id: new Date().toISOString() }, - ]); + + queryClient.setQueryData(eventsNamespace, (old) => + old.splice(newEvent.order, 0, { + ...newEvent, + id: new Date().toISOString(), + }) + ); // Return a context with the previous and new todo return { previousEvents };