Error with Custom Like Button example

I’m referring to this example: https://www.wix.com/corvid/example/custom-like-button

At the time of writing this; if click the like button there is a delay in response.
If you click it again multiple time you gonna be surprised of the result.

Instead of making the like count going up , it goes down.
Yet in this is example beforeInsert was used in the backend, duplicate entry was not prevented .

I face this problem with other API as wixData (query, getCurrentItem,…)
I try setTimeout and chaining promises to avoid this issue but didn’t workout for me.

Is there a way to solve the issue?

I’m looking into this.

Hey @abdullahalnabi ,
I’m not able to recreate the issue. Can you provide some more details? What browser are you using? What exactly happens when you click multiple times?

Expected behavior is that the like count increases by 1 on the first click (adding your like) and decreases by 1 when you click again (removing your like). If you click multiple times, it should cycle through adding and subtracting 1 to the count.

I just posted screen recording below.
What do you think of the cause of this error? and how to fix it ?

Chrome Version 85.0.4183.83 (64-bit)