-
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
Migrate Composer. web #23359
Migrate Composer. web #23359
Conversation
…composer-fc-web
…composer-fc-web
…into migrate-composer-fc-web
…composer-fc-web
@perunt, please fix the lint issues. You can use the lint command from package.json scripts |
it's quite weird that optional chaining is prohibited, as I saw it in the code |
src/components/Composer/index.js
Outdated
caretContent: this.getNextChars(this.props.value, event.nativeEvent.selection.start), | ||
}, | ||
const addCursorPositionToSelectionChange = (event) => { | ||
flushSync(() => { |
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.
Could you explain the usage of flushSync here?
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.
I need to return up-to-date data for positioning an inline autosuggestion within the callback. If we remove flushSync
, we will receive an outdated value, which will lag(be delayed) by one value
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.
I see, thanks for the explanation!
src/components/Composer/index.js
Outdated
ref={setTextInputRef} | ||
selection={selection} | ||
style={[ | ||
StyleSheet.flatten([style, {outline: 'none'}]), |
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 some places, implementation is slightly different. Could you explain why these changes? There is no outline: 'none', old code.
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 use the outline in the old code here
do you mean using useMemo for 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.
Thanks, it's ok, I couldn't find this style because git diff changes are going crazy, harder to compare
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.
Yeah, sometimes it just gets too messy 😄
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.
Overall LGTM, please fix lint errors.
@ArekChr should be good to go |
Hey @perunt, it looks like the test steps are missing. Could you update the location where I can check the logs, especially if no errors occur? Thank you! |
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.
I compared both files separately because the git diff was difficult to follow. It appears that the implementations have slightly changed, e.g. updateNumberOfLines
has been removed. Please retain the original logic and only rewrite the class lifecycle methods with hooks, so the outcome will more accurately reflect the original implementation.
…composer-fc-web
@ArekChr, any issue here so far? |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-08-15.at.4.24.42.PM.movMobile Web - ChromeScreen.Recording.2023-08-15.at.4.41.19.PM.movMobile Web - SafariScreen.Recording.2023-08-15.at.4.39.48.PM.movDesktopScreen.Recording.2023-08-15.at.5.02.07.PM.moviOSScreen.Recording.2023-08-15.at.4.58.01.PM.movAndroidScreen.Recording.2023-08-15.at.4.51.17.PM.mov |
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.
Tests well!
Screen recordings are missing for iOS and android but I'm approving it since this is urgent.
It's a WEB-only change, next time will add it. |
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.
Thanks for the quick testing @allroundexperts
@perunt Keep an eye on #expensify-bugs in case there is anything new from this refactoring as its quite complex
checkComposerVisibility: () => false, | ||
}; | ||
// Get characters from the cursor to the next space or new line | ||
const getNextChars = (str, cursorPos) => { |
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.
I think that would be handy but we can make it in a follow up PR
✋ 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/mountiny in version: 1.3.55-0 🚀
|
looks like this caused this regression #25409 where if you copy some text, open any RHP then paste it will paste your clipboard contents twice. |
And maybe this one: #25413 |
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.56-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.56-24 🚀
|
Coming from #25413: |
This caused Web - App adds extra line in edit message box |
setSelection((prevSelection) => { | ||
if (!!prevSelection && selectionProp.start === prevSelection.start && selectionProp.end === prevSelection.end) { | ||
return; | ||
} | ||
return selectionProp; | ||
}); |
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.
Coming from #44259, instead of using a set state function updater, we can use setState function directly
Details
Fixed Issues
$ #16129
PROPOSAL:
Tests
Offline tests
QA Steps
This PR updated the composer related to text input only on WEB
Test Case 1: Input Functionality
Test Case 2: Multiline Input Functionality
Test Case 3: Focus Functionality
Test Case 4: Style Functionality
Test Case 5: Message Sending Functionality
PR 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
Screen.Recording.2023-07-27.at.14.18.50.mov
Mobile Web - Chrome
telegram-cloud-document-2-5336800175870455938.mp4
Mobile Web - Safari
Screen.Recording.2023-07-27.at.14.46.54.mov
Desktop
Screen.Recording.2023-07-27.at.15.07.41.mov
iOS
Android