Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/add optimistic UI in like post #101

Merged

Conversation

adityav477
Copy link

@adityav477 adityav477 commented Oct 28, 2024

fixes issue -> #39

@harshmangalam
Copy link
Owner

In optmistic ui updates we do not depend of timeout we just updates the current state of ui with the help of whatever data we have available from user input and revalidate the ui again after server response. In case of error the updated ui will automatically revert back to previous state and if success it will be replaced with server latest data.

@adityav477
Copy link
Author

adityav477 commented Oct 28, 2024

used the setTimeout to avoid calling multiple request to backend if the user agressively clicks the like button
thank you for correcting

@harshmangalam harshmangalam changed the base branch from main to dev October 28, 2024 18:09
@harshmangalam harshmangalam merged commit 90ef7f6 into harshmangalam:dev Oct 28, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants