Repository navigation
fix: 29378 Distance - Search is open in background on distance image preview - #30556
Conversation
ArekChr
left a comment
There was a problem hiding this comment.
I've noticed some issues in the parts of our app where we use setCloseModal. It seems like it’s not working correctly in all cases.
Also, I’m confused about why we are using a key and a count number for closing modals. I can’t find where we really need the count number or how it helps us. Can someone explain why we use this system? I think maybe we can make it simpler by rewriting closeModals object to an array.
| /** | ||
| * Get the available key that we can store the onClose callback into it | ||
| */ | ||
| function getAvailableKey() { |
There was a problem hiding this comment.
This function increases a number to make new keys. This could cause problems if we make a lot of keys over time or if many things happen at once.
|
@ArekChr Thanks for your review. If we use the array, how can we clear the onClose function when the modal is hidden? |
|
@tienifr I think the |
|
@ArekChr Thanks for your suggestion. I just update the PR. Thanks |
|
@tienifr I've noticed a regression issue with shortcuts: CMD+K or CMD+J don't open the chat or shortcuts menu as they should and only work after switching chats. On the main branch it works as expected. |
Ah, my bad. I forgot the case when closeModals is empty. We already implemented that case before, and I just did the same. Thanks for your comment. I updated |
| const reverseCloseModals = [...closeModals].reverse(); | ||
| reverseCloseModals.forEach((onClose) => { |
There was a problem hiding this comment.
nit.
| const reverseCloseModals = [...closeModals].reverse(); | |
| reverseCloseModals.forEach((onClose) => { | |
| [...closeModals].reverse().forEach((onClose) => { |
| onOpenCallback: () => Modal.setCloseModal(() => props.onClose(props.anchorRef)), | ||
| onCloseCallback: removeOnClose.current, | ||
| onOpenCallback: () => { | ||
| removeOnClose.current(); |
There was a problem hiding this comment.
Is this needed? Is this workaround associated with the logic for opening and closing modals?
There was a problem hiding this comment.
Before saving onClose, we need to remove the previous one right? Although we have the logic to prevent saving duplicate onClose but we just compare the reference. It's not really correct because the reference can be changed (even they have the same mean).
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromemweb.chrome.moviOS: Nativeios.moviOS: mWeb Safarimweb.safari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
|
@ArekChr Ah I see, we can move the removeOnClose ref to useEffect and call it in cleanup function |
|
@ArekChr Thanks for pointing that out. Updated |
ArekChr
left a comment
There was a problem hiding this comment.
All works, skipped mobile screenshots as we don't use keyboard shortcuts here, thanks!
|
@pecanoro Uploaded videos for all mobile platforms. Let me know if we can test more modal use cases to ensure everything works properly. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/pecanoro in version: 1.4.2-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.4.2-3 🚀
|
| close: props.onClose, | ||
| anchorRef: props.anchorRef, | ||
| onCloseCallback: () => Modal.setCloseModal(null), | ||
| onOpenCallback: () => Modal.setCloseModal(() => props.onClose(props.anchorRef)), |
There was a problem hiding this comment.
Coming from #32743, it looks like we haven't removed these two callbacks completely, so it caused that bug.
Details
Fixed Issues
$ #29378
PROPOSAL: #29378 (comment)
Tests
Offline tests
Same as above
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
Screenrecorder-2023-10-29-18-02-59-704.mp4
iOS: Native
iOS: mWeb Safari
Screen.Recording.2023-10-29.at.18.02.27.mov
MacOS: Chrome / Safari
Screen.Recording.2023-10-29.at.17.55.06.mov
MacOS: Desktop
Screen.Recording.2023-10-29.at.18.19.44.mov