How to prevent onEventCreate from firing when clicking on an invalid slot

Hi.
I’m running into a situation which I’m not sure how to handle with the Event Calendar.

I’m using onEventCreate to open a modal with a form when creating events. I also set several recurring invalid times during the week. Clicking on an invalid slot still triggers the onEventCreate. How can I prevent this?

Hi, for opening a modal on event creation, you can use the onEventCreated event.
This will not be fired if the event creation failed.
Also, the onEventCreate runs in the render phase, meaning that you cannot call state updates from there (e.g. opening a modal), unless you do it with a setTimeout. On the other hand onEventCreated will run when the render is finished and the DOM updates are ready.
Check our CRUD demo for a working implementation.