stream-chat-react-native
stream-chat-react-native copied to clipboard
Removed File reappears in the fileUploads array
Describe the bug have a use case where i want to remove a file which was selected from the attachment picker. I tried calling the removeFile() provided by the MessageInputContext. Once I call it the file gets deleted from the fileUploads but somehow reappears in the fileUploads array (fileUploads- provided by the MessageInputContext). How does this happen as I'm not manually re-selecting the removed file?PS: removeImage() is working fine. But removeFile() doesn't. My code: const MessageInputComponent = () => { const { toggleAttachmentPicker, imageUploads, removeImage, fileUploads, removeFile } = useMessageInputContext();
// Working fine useEffect(() => { removeImage(imageUploads[0]?.id); }, [imageUploads, removeImage]);
// Not working (the removed file reappears in the fileUploads array) useEffect(() => { removeFile(fileUploads[0]?.id); }, [fileUploads, removeFile]);
Dev environment info (please complete/provide the following information): Package Versions: "react-native": "0.66.4", "stream-chat": "^6.3.0", "stream-chat-react-native": "^4.6.1”
Expected behavior The removed file should not reappear in the fileUploads array provided by stream's MessageInputContext.
Hi @vinaygregoryjohn183, thanks for reaching out. I've managed to reproduce this issue.
After removing the file, the file is not visible in the MessageInput
component yet present in the fileUploads
array originating from useMessageInputContext
.
We might be over-memoizing something or setting the state twice. We will take a look at it. You can keep on following this issue for any updates.
Out of curiosity, what impact does it have on you and your users if the UI works as expected?
Hey team! Please add your planning poker estimate with ZenHub @Enigma-I-am @khushal87 @madsroskar
Out of curiosity, what impact does it have on you and your users if the UI works as expected?
@vinaygregoryjohn183 is this still an issue? A lot has changed in our SDK still this issue was created
This issue became stale. I'll be closing this issue for now. Please don't hesitate to contact us in the future if this issue or any questions arise.