Repository navigation
fix: check deletion with confirmation modal - #24022
dummy-1111 wants to merge 2 commits into
Conversation
| useEffect(() => { | ||
| // required for keeping last state of isFocused variable | ||
| isFocusedRef.current = isFocused; | ||
| }, [isFocused]); | ||
|
|
There was a problem hiding this comment.
Can you explain why this is needed? @s77rt
There was a problem hiding this comment.
The change is not needed. Let's just add the missing condition
There was a problem hiding this comment.
Reverting raises an issue. In android chrome, text input gets focused after deletion and then draft is unmounted. So main composer gets hidden. When the draft is deleted, isFocusedRef.current is false even the input gets focused due to the effect delay.
There was a problem hiding this comment.
Using ref only, we can avoid this
There was a problem hiding this comment.
@s77rt How about using ref only solution? This works on all platforms
| // When user tries to save the empty message, it will delete it. Prompt the user to confirm deleting. | ||
| if (!trimmedNewDraft) { | ||
| ReportActionContextMenu.showDeleteModal(props.reportID, props.action, false, deleteDraft, () => InteractionManager.runAfterInteractions(() => textInputRef.current.focus())); | ||
| ReportActionContextMenu.showDeleteModal(props.reportID, props.action, false, deleteDraft); |
There was a problem hiding this comment.
In ReportActionItem, hideDeleteModal is called and then this cancel callback is called. focusing on non-existent element raises an error
There was a problem hiding this comment.
What does this have to do with the previous PR changes?
There was a problem hiding this comment.
This is a hidden bug. I don't think the previous PR introduced this bug
There was a problem hiding this comment.
Please do not make changes that does not reflect the PR scope unless we are fixing another bug - it seems we are removing a feature. We revert the first PR and find a solution to this. I think your solution won't work due to how useEffects propogate.
At first ReportActionContextMenu.isActiveReportAction will be true, but at the end in the useEffect it will be false. The main composer won't show.
There was a problem hiding this comment.
At first ReportActionContextMenu.isActiveReportAction will be true, but at the end in the useEffect it will be false. The main composer won't show.
That's true. So I don't use ReportActionContextMenu.isActiveReportAction in useEffect
Please do not make changes that does not reflect the PR scope unless we are fixing another bug
We can't solve this issue because deleting the draft this way raises an error in android native
There was a problem hiding this comment.
We revert the first PR and find a solution to this
What's your solution?
There was a problem hiding this comment.
Please test your solution in android native
There was a problem hiding this comment.
The old PR was reverted by @marcochavezf
What should we do now?
There was a problem hiding this comment.
We need to find a fix for the regression. Let's continue working on this on the issue
|
@s-alves10 Can you please close this PR? |
Details
Fixed Issues
$ #24016
PROPOSAL: #24016 (comment)
Tests
Deleteon delete confirmation modalOffline tests
Deleteon delete confirmation modalQA Steps
Deleteon delete confirmation modalPR 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 */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)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
Web
24016_mac_chrome.mp4
Mobile Web - Chrome
24016_android_chrome.mp4
Mobile Web - Safari
24016_ios_safari.mp4
Desktop
24016_mac_desktop.mp4
iOS
24016_ios_native.mp4
Android
24016_anrdoid_native.mp4