Nextion buttons working slowly

Hi, i am using nextion lcd and esp32 in my project where i am facing the issue when wifi of esp32 is connected and then the dual state buttons on the lcd works very slowly, i.e when i press 10 to 20 times, buttons gets pressed, can anyone please tell me know the solution for this.
Thank you

Difficult to tell without knowing more details about your code. How are the button presses transmitted? With “Send Component ID” or your own Nextion custom code? Then, how is the incoming data from the Nextion handled on the ESP? And finally, how does it get sent over Wifi?

Too many unknown details to give meaningful advice.

Button presses are transmitted using component ID and through UART communication, data is transferred from esp to nextion.

Here we have used,
Button.attachPop(ButtonCallBack,NULL);

value = Buttons.getValue(&n);
void ButtonCallBack(void *Parameter)
{
if(value)
{
printf(“button pressed”);
}
else
printf(“button released”);
}
For now we are not sending any data through wifi, but just after connecting wifi this button responses after pressing several times