-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add comment local ids to OnCommentChanged events #250
Add comment local ids to OnCommentChanged events #250
Conversation
@@ -399,6 +407,7 @@ private void pushComment(RemoteCommentPayload payload) { | |||
if (payload.comment == null) { | |||
OnCommentChanged event = new OnCommentChanged(0); | |||
event.causeOfChange = CommentAction.PUSH_COMMENT; | |||
event.changedCommentsLocalIds.add(payload.comment.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will throw an NPE as payload.comment
is null here.
It's possible for the |
Fixed in 5ceb77d - I wasn't able to make the |
@@ -309,6 +307,7 @@ private void updateComment(CommentModel payload) { | |||
rowsAffected = CommentSqlUtils.insertOrUpdateComment(payload); | |||
} | |||
OnCommentChanged event = new OnCommentChanged(rowsAffected); | |||
event.changedCommentsLocalIds.add(payload.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be null
checked as well, since an UPDATE_COMMENT
action can legitimately be called from a FluxC client (and be null
). This applies to the payload.isError()
check in this same method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, I'm not sure about null checking all payloads in all stores. I don't know if we should add @NonNull
to our actions.
@@ -317,12 +316,14 @@ private void removeComment(CommentModel payload) { | |||
int rowsAffected = CommentSqlUtils.removeComment(payload); | |||
OnCommentChanged event = new OnCommentChanged(rowsAffected); | |||
event.causeOfChange = CommentAction.REMOVE_COMMENT; | |||
event.changedCommentsLocalIds.add(payload.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above comment, payload
could be null
.
No description provided.