File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
contexts/messageInputContext Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -248,17 +248,17 @@ const MessageInputWithContext = <
248248 } = useAttachmentPickerContext ( ) ;
249249
250250 /**
251+ * Mounting and un-mounting logic are un-related in following useEffect.
251252 * While mounting we want to pass maxNumberOfFiles (which is prop on Channel component)
252253 * to AttachmentPicker (on OverlayProvider)
254+ *
255+ * While un-mounting, we want to close the picker e.g., while navigating away.
253256 */
254257 useEffect ( ( ) => {
255258 setMaxNumberOfFiles ( maxNumberOfFiles ?? 10 ) ;
256- } , [ ] ) ;
257259
258- /**
259- * While un-mounting, we want to close the picker e.g., while navigating away.
260- */
261- useEffect ( ( ) => closeAttachmentPicker , [ closeAttachmentPicker ] ) ;
260+ return closeAttachmentPicker ;
261+ } , [ ] ) ;
262262
263263 const selectedImagesLength = selectedImages . length ;
264264 const imageUploadsLength = imageUploads . length ;
Original file line number Diff line number Diff line change @@ -577,9 +577,7 @@ export const MessageInputProvider = <
577577 } ;
578578
579579 const closeAttachmentPicker = ( ) => {
580- if ( selectedPicker ) {
581- setSelectedPicker ( undefined ) ;
582- }
580+ setSelectedPicker ( undefined ) ;
583581 closePicker ( ) ;
584582 } ;
585583
You can’t perform that action at this time.
0 commit comments