[FIX] MessagesView duplicating content#2307
Merged
diegolmello merged 4 commits intoRocketChat:developfrom Jul 17, 2020
refactor-droidyy:pagination
Merged
[FIX] MessagesView duplicating content#2307diegolmello merged 4 commits intoRocketChat:developfrom refactor-droidyy:pagination
diegolmello merged 4 commits intoRocketChat:developfrom
refactor-droidyy:pagination
Conversation
djorkaeffalexandre
suggested changes
Jul 17, 2020
Contributor
djorkaeffalexandre
left a comment
There was a problem hiding this comment.
Hey @refactor-droidyy! Thanks for your first contribution! It's awesome to see new people contributing to our project. 🤗
This changes doesn't fix the error properly, the error is related to this function.
The messages is accessed when we call this function (at the constructor time), so, all access to messages.length inner this function are always returning 0, since it was instantiated once before.
The right solution is access messages state at each fetchFunc, like this:
fetchFunc: async() => {
const { messages } = this.state;
const result = await RocketChat.getFiles(this.rid, this.t, messages.length);
return { ...result, messages: result.files };
}
Contributor
Author
|
@djorkaeffalexandre Thankyou very much for helping me in my first contribution :) I have changed as per your direction please have a look . |
diegolmello
added a commit
that referenced
this pull request
Sep 1, 2020
@RocketChat/ReactNative
Closes #2287
Current while setting the state in MessageView we are using messages : [ ...messages , ...result.messages] which is causing duplicacy in file attachments so changed to [..result.message] which is the fetch response array and it works fine.