onBeforeTaskAdd being called multiple times with the same task id

Hi DHX team,
I’m using the gantt in React, and registered “onBeforeTaskAdd” once in my code.
Most of time, when I create a task, the “onBeforeTaskAdd” is called once. This is correct.
But sometime, when I create a task, the “onBeforeTaskAdd” is called multiple times, with the same task id.
In the “onBeforeTaskAdd” callback function, I called the server API to created the task. So the server API is also called multiple times.

How can I solve this problem? Thank you!

OK. I think I found the reason. The “onBeforeTaskAdd” is registered multiple times.