-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: check deletion with confirmation modal #24022
Conversation
useEffect(() => { | ||
// required for keeping last state of isFocused variable | ||
isFocusedRef.current = isFocused; | ||
}, [isFocused]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why this is needed? @s77rt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change is not needed. Let's just add the missing condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@s77rt
reverted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using ref only, we can avoid this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@s77rt How about using ref only solution? This works on all platforms
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this have to do with the previous PR changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a hidden bug. I don't think the previous PR introduced this bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We revert the first PR and find a solution to this
What's your solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please test your solution in android native
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old PR was reverted by @marcochavezf
What should we do now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Delete
on delete confirmation modalOffline tests
Delete
on delete confirmation modalQA Steps
Delete
on delete confirmation modalPR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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