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

Show new comment in UI #29

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

johnnyoshika
Copy link

@johnnyoshika johnnyoshika commented Jan 11, 2020

When a new comment is added, it now displays in the UI. It uses optimistic UI to immediately render the new comment, then updates based on the GraphQL mutation response. This fulfills this exercise:

https://www.robinwieruch.de/react-graphql-apollo-tutorial#exercise-commenting-feature

Improve the AddComment component with the optimistic UI feature (perhaps read again the Apollo documentation about the optimistic UI with a list of items). A comment should show up in the list of comments, even if the request is pending.

Known issues

Missing author.login

The author's login isn't being fetched, so during the optimistic UI rendering and before the server responds to the addComment mutation, the author's login is displayed as me.

During optimistic UI:

image

After server response

image


Paginating after new comment insertion

Update 2020-01-18: this has been fixed. See comment below.
When paginating after a new comment is inserted, and when the newly inserted comment returns from the server through pagination, this results in an ID conflict:
image
This also results in a duplicate comment, even through they have the same ID.

To reproduce:

  • Insert a new comment
  • Keep clicking More Comments until the newly inserted comment appears a second time

Can you please suggest how we can remedy this problem?

@johnnyoshika
Copy link
Author

Note: the pagination problem after a new comment is added has been fixed with this commit: b20e7a1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant