Issue with onEventUpdate on EventCalendar

I’m currently using the EventCalendar and have encountered an issue. When dragging and dropping an event between resources, I would like to employ the updateEvent lifecycle with an asynchronous callback function to confirm the drag-and-drop action. I intend to confirm this action through a custom dialog, where the buttons (Yes/No) resolve a Promise, subsequently returning a boolean value (true/false). However, even when the return value is false, the UI does not revert to its previous state.
Is it possible to use an asynchronous callback function in the EventCalendar component? Here’s the code snippet for clarity:

 const onEventUpdate = async (): Promise<boolean> => {
  const resp = await awaitModal();
  return resp;
 };
<Eventcalendar
   onEventUpdate={onEventUpdate}
  // other lifecycle callbacks	
/>

Thank you

Hi @Akoom_Tech

Thanks for the question. The onEventUpdate function expects a boolean as a return value, not a promise. Since async functions return a promise, you will need to change the function to a synchronous one:

 const onEventUpdate = (): boolean => {
  awaitModal().then((resp) => {
    // handle the response here
  });
  return false;
 };
<Eventcalendar
   onEventUpdate={onEventUpdate}
  // other lifecycle callbacks	
/>

After you return false, the event update will be cancelled and you can re-run programmatically the modification intended based on the response in the then(...) clause.

Let me know if that makes sense or if something is not clear!