-
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
[$1000] Chat - Cursor does not remain the same place when Edit message #25413
Comments
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open
|
Triggered auto assignment to @neil-marcellini ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Cursor is not remaining on it's place when inserting emoji What is the root cause of that problem?there is a prop to enable the calculation of the caret position, and it utilizes App/src/components/Composer/index.js Lines 207 to 208 in b7fdbcb
we are trying to access a value from App/src/components/Composer/index.js Line 450 in 9474292
What changes do you think we should make in order to solve the problem?We should add
Alternatively we can add a check if textRef is defined and calculate the position accordingly to prevent null value. const selectionValue = {
...
positionX: textRef.current ? textRef.current.offsetLeft - CONST.SPACE_CHARACTER_WIDTH : undefined,
positionY: textRef.current ? textRef.current.offsetTop : undefined,
}; What alternative solutions did you explore? (Optional) |
@getusha |
@situchan updated my proposal explaining the root cause further |
ProposalPlease re-state the problem that we are trying to solve in this issue.Chat - Cursor does not remain the same place when Edit message What is the root cause of that problem?The logic of this function was changed - App/src/components/Composer/index.js Lines 195 to 216 in 5a1b35c
Earlier, if What changes do you think we should make in order to solve the problem?We should use the same logic, change the function to - const addCursorPositionToSelectionChange = (event) => {
if (shouldCalculateCaretPosition) {
// we do flushSync to make sure that the valueBeforeCaret is updated before we calculate the caret position to receive a proper position otherwise we will calculate position for the previous state
flushSync(() => {
setValueBeforeCaret(event.target.value.slice(0, event.nativeEvent.selection.start));
setCaretContent(getNextChars(value, event.nativeEvent.selection.start));
});
const selectionValue = {
start: event.nativeEvent.selection.start,
end: event.nativeEvent.selection.end,
positionX: textRef.current.offsetLeft - CONST.SPACE_CHARACTER_WIDTH,
positionY: textRef.current.offsetTop,
};
onSelectionChange({
nativeEvent: {
selection: selectionValue,
},
});
setSelection(selectionValue);
return;
}
onSelectionChange(event);
setSelection(event.nativeEvent.selection);
}; What alternative solutions did you explore? (Optional)Alternatively, we can pass |
Hey @situchan, the logic of that function was changed which changed the behaviour of composer when You can check here that when |
@Nikhil-Vats when |
I disagree @getusha, I actually don't agree with your RCA completely, part of it is correct (although difficult to understand) and the other part seems wrong -
if ref is Anyway, whatever @situchan decides is fine with me. |
You can confirm the value being null by logging it to the console. what you proposed as a solution is equivalent to mine which is: const selectionValue = {
...
positionX: textRef.current ? textRef.current.offsetLeft - CONST.SPACE_CHARACTER_WIDTH : undefined,
positionY: textRef.current ? textRef.current.offsetTop : undefined,
}; instead of checking textRef we could also check the prop which is equivalent thing. and you haven't explained why it's not executing |
Hey guys, I think I know where the problem is. So here is my proposal-fix The issue is reproducible because the
|
Untitled.mov |
Yes, you are right, it has the same root
For the one whose proposal will be chosen, please ensure that |
Thanks for suggestions @perunt |
I don't understand the root cause explained in @getusha's proposal. I like @Nikhil-Vats' root cause explanation and proposal better. Thanks for your thoughts @perunt. Do you suggest any changes to @Nikhil-Vats' proposal? Does that sound good @situchan? The root cause is the most important part of the proposal so that's why I prefer the other proposal. |
@neil-marcellini the root cause is that we are trying to access a key from a ref which has a value of null. |
@getusha's root cause is correct (thought not sure why console doesn't show error). Regarding solution, I am fine either way. One proposes to pass filtered custom event always, while another one proposes to pass raw event when |
@situchan @neil-marcellini I can implement @perunt's solution or mine right away if you agree. Otherwise, the only issue @perunt mentioned in my solution was that I need to call
@perunt pointed that we shouldn't set
|
I explained that the solution is equivalent to mine and your proposal didn't explain why it's not executing |
@situchan @neil-marcellini the reason it's not throwing an error is a bug from react-native-web it's contained in a try and catch block, which prevents the error from being shown. if you change the catch block to log the error inside |
📣 @Nikhil-Vats 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
📣 @situchan 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
Ok @situchan is the C+ and @Nikhil-Vats will be implementing it. I'm also removing the blocker label because it's a small regression. |
It's quite disappointing decision after I identified the correct Root cause #25413 (comment), while the selected lacks the correct root cause and has the same proposal as mine. @neil-marcellini i respect your decision 🙂 |
PR is up for review. |
🎯 ⚡️ Woah @situchan / @Nikhil-Vats, great job pushing this forwards! ⚡️ The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉
On to the next one 🚀 |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
@JmillsExpensify @neil-marcellini i think there's something wrong with the automation here. The overdue label is not added and the payment date is also not mentioned in title despite the PR being deployed to prod 13 days ago. |
Hi @JmillsExpensify bump on this since labels are not being added here. |
Hey @JmillsExpensify, this one is due for payment. |
I'll get Jason on it. It's best to message him directly in NewDot. |
Thanks for reaching out. Catching up and processing payments. |
Payment summary:
|
Contributor payment issued. @situchan do you mind completing the BZ checklist before I issue payment? |
I have offer accepted already - #25413 (comment) |
This was caught by Applause team, which means always exists in Testrail. |
Great thanks! I don't see any outstanding contracts for you for this job, so I went ahead and extended one. |
My records are showing that everyone has been paid for this issue. Closing! Please reach out if that's incorrect. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Expected Result:
New emoji should be added in field where the cursor was pointed
Actual Result:
Cursor does not remain the same place when Edit message. New emoji is added at the end of the message instead on the place where the cursor was last pointed
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.55-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Bug6168233_Recording__749.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: