fix composer hidden while loading messages#12505
Conversation
|
@rushatgabhane do you have time to test this today? Also @0xmiroslav can you please resolve conflicts ASAP? 🙏 |
fixed |
src/pages/home/ReportScreen.js
Outdated
| containerHeight={this.state.skeletonViewContainerHeight} | ||
| /> | ||
| )} | ||
| {this.isReportReadyForDisplay() && !isLoadingInitialReportActions && ( |
There was a problem hiding this comment.
@0xmiroslav question: should the footer wait for initialReportActions to load?
There was a problem hiding this comment.
No, without removing !isLoadingInitialReportActions && condition, issue still happens:
loading.mov
There was a problem hiding this comment.
@0xmiroslav I meant in the current code do we need to check if initial report actions are loading?
There was a problem hiding this comment.
There was a problem hiding this comment.
Can you please summarize whatever question you have and what you have tried so far to solve the problem?
There was a problem hiding this comment.
Without looking into whether it is "safe" or not - I'd assume no code is "safe" to remove unless we understand what it does and can explain why it's not needed.
There was a problem hiding this comment.
I am referring to this.isReportReadyForDisplay() && !isLoadingInitialReportActions (I clearly explained in screenshot).
It's not needed because we don't want to hide composer while showing skeleton.
I think It's safe to remove this because you just refactored and added this condition based on this change and instead I added key for re-render.
There was a problem hiding this comment.
Going off of what little has been provided I would say that forcing a re-render with a key could work, but we need to be sure that we are not showing a "composer" that is matched with the previous report. It's possible to transition from one report to another - which is why we hide/show the composer.
I would probably suggest showing some kind of placeholder composer, but you are welcome to get more feedback in the Slack channel.
@rushatgabhane @Beamanator Was this detail considered during the design/proposal stage?
There was a problem hiding this comment.
we need to be sure that we are not showing a "composer" that is matched with the previous report
I think we can be sure because after adding key, composer is completely re-rendered whenever reportID changes. And comment for updated reportID is handled in constructor and componentDidMount already
There was a problem hiding this comment.
There is some time before the report.reportID is correct. Review this and it will hopefully make more sense:
App/src/pages/home/ReportScreen.js
Lines 154 to 162 in 0422c5f
src/pages/home/ReportScreen.js
Outdated
| onSubmitComment={this.onSubmitComment} | ||
| /> | ||
| )} | ||
| <ReportFooter |
There was a problem hiding this comment.
@0xmiroslav polish (blocking): we could add ReportFooter as a placeholder inside Freezecomponent.
This will show the footer when transitioning away from the screen for mobiles.
2Screen.Recording.2022-11-08.at.9.59.15.PM.mov
There was a problem hiding this comment.
updated this suggestion to blocking. i really think we should add ReportFooter in the placeholder for Freeze.
let me know if you have any questions
There was a problem hiding this comment.
Adding ReportFooter to placeholder for Freeze is a good suggestion but causes another complicated issue.
App/src/pages/home/ReportScreen.js
Line 231 in ea35c46
When open Report page first time,
skeletonViewContainerHeight is not calculated yet. Therefore, composer floats to the top when swipe drawer first time.
Screen.Recording.2022-11-08.at.7.53.45.PM.mov
And I think this is out of this GH scope. It tagged only Web platform along with issue title.
There was a problem hiding this comment.
@Beamanator, @0xmiroslav and I need help deciding
Should we implement the suggestion in this PR itself?
There was a problem hiding this comment.
When open Report page first time, skeletonViewContainerHeight is not calculated yet. Therefore, composer floats to the top when swipe drawer first time
That's a great catch! We could align the composer to flexEnd, no?
There was a problem hiding this comment.
I agree with @rushatgabhane. It doesn't need to be an actual ReportFooter component? We just need to put something there to make the transition less jumpy.
There was a problem hiding this comment.
When open Report page first time, skeletonViewContainerHeight is not calculated yet. Therefore, composer floats to the top when swipe drawer first time.
Put it in the ReportActionsSkeletonView then
There was a problem hiding this comment.
@marcaaron you might feel I didn't respond for 2 weeks on this thread but I already tagged you when PR is ready for review here - #12505 (comment).
And you said I won't be reviewing this PR
So this can't be not responding to a comment for 2 weeks
|
@rushatgabhane
|
|
bumping @rushatgabhane @Beamanator on this. I won't be reviewing this PR. |
@marcaaron sorry for that. But you can just check NOTE and give feedback (👍 or 👎) |
|
Not sure why Github removed @Beamanator when I re-request @rushatgabhane |
src/pages/home/ReportScreen.js
Outdated
| <ReportActionsSkeletonView | ||
| containerHeight={this.state.skeletonViewContainerHeight} | ||
| shouldShowComposer | ||
| /> |
There was a problem hiding this comment.
@0xmiroslav composer isn't related to ReportActionsSkeletonView.
suggestion: render the dummy composer directly.
There was a problem hiding this comment.
@rushatgabhane one more thing:
what is your suggestion for input placeholder in dummy composer?
For now, it's saying "Write something..."
But the issue is that when open new chat, it will change to "Say hello!"
src/pages/home/ReportScreen.js
Outdated
| <ReportHeaderSkeletonView /> | ||
| <ReportActionsSkeletonView containerHeight={this.state.skeletonViewContainerHeight} /> | ||
| <View style={[styles.flex1, styles.justifyContentEnd, styles.overflowHidden]}> | ||
| <ReportActionsSkeletonView containerHeight={this.state.skeletonViewContainerHeight} shouldShowComposer /> |
There was a problem hiding this comment.
rushatgabhane
left a comment
There was a problem hiding this comment.
We keep current logic of conditionally rendering ReportFooter (don't add key)
At the condition of not rendering ReportFooter, instead show dummy ReportFooter along with skeleton (this is after freeze gone)
show dummy ReportFooter in freeze view
@0xmiroslav I don't quite agree with this approach. There are a few issues.
-
If a chat is loading and something is typed inside the composer, the draft will disappear after the chat has loaded because it was present in the dummy composer.
-
All loading reports have the same composer, so the draft text will also be the same across different loading reports.
Screen.Recording.2022-11-12.at.1.27.44.AM.mov
|
@rushatgabhane I suggest not allow all user interactions (+, emoji, send buttons, user input) in dummy composer, and blank placeholder |
|
@0xmiroslav I'd find that frustrating as a user. So let's not disable any user interactions |
|
We currently have issue of loading with skeleton forever sometimes in current version. I think this is a good testcase for this issue. |
|
@0xmiroslav yes, we should for sure allow interactions. let's discuss on slack for more eyes if you still disagree |
I think we should go back to |
|
@0xmiroslav agree with you 👍 |
|
@rushatgabhane ready for review |
marcaaron
left a comment
There was a problem hiding this comment.
I had some style improvements but I think I will just start adding commits here to push this along.
|
@marcaaron fixed all of your feedback |
|
@rushatgabhane what's the status of your review here? Can you please prioritize this? |
marcaaron
left a comment
There was a problem hiding this comment.
Code looks great, thanks for your patience her @0xmiroslav
|
@rushatgabhane are you able to re-review on all platforms today? If not, please let me know and I will take care of it |
There was a problem hiding this comment.
Reviewer Checklist
@Beamanator LGTM!
Unrelated to PR - It kinda takes forever to load chats 😅
- I have verified the author checklist is complete (all boxes are checked off).
- I verified the correct issue is linked in the
### Fixed Issuessection above - I verified testing steps are clear and they cover the changes made in this PR
- I verified the steps for local testing are in the
Testssection - I verified the steps for Staging and/or Production testing are in the
QA stepssection - I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- I verified the steps for local testing are in the
- I checked that screenshots or videos are included for tests on all platforms
- I included screenshots or videos for tests on all platforms
- I verified tests pass on all platforms & I tested again on:
- iOS / native
- Android / native
- iOS / Safari
- Android / Chrome
- MacOS / Chrome
- MacOS / Desktop
- If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
- I verified proper code patterns were followed (see Reviewing the code)
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
toggleReportand notonIconClick). - I verified that comments were added to code that is not self explanatory
- I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- I verified any copy / text shown in the product was added in all
src/languages/*files - I verified any copy / text that was added to the app is correct English and approved by marketing by adding the
Waiting for Copylabel for a copy review on the original GH to get the correct copy. - I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
- I verified the JSDocs style guidelines (in
STYLE.md) were followed
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
- If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- I verified that this PR follows the guidelines as stated in the Review Guidelines
- I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like
Avatar, I verified the components usingAvatarhave been tested & I retested again) - I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
- If a new component is created I verified that:
- A similar component doesn't exist in the codebase
- All props are defined accurately and each prop has a
/** comment above it */ - The file is named correctly
- The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- The only data being stored in the state is data necessary for rendering and nothing else
- For Class Components, any internal methods passed to components event handlers are bound to
thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor) - Any internal methods bound to
thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick) - All JSX used for rendering exists in the render method
- The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
- If a new CSS style is added I verified that:
- A similar style doesn't already exist
- The style can't be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
- If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like
Avataris modified, I verified thatAvataris working as expected in all cases) - If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.
Screenshots/Videos
Web
Screen.Recording.2022-12-05.at.10.47.50.PM.mov
Mobile Web - Chrome
Screen.Recording.2022-12-06.at.12.03.14.AM.mov
Mobile Web - Safari
Screen.Recording.2022-12-06.at.12.01.42.AM.mov
Desktop
Screen.Recording.2022-12-05.at.11.57.56.PM.mov
iOS
Screen.Recording.2022-12-05.at.11.51.18.PM.mov
Android
WhatsApp.Video.2022-12-05.at.23.56.21.mp4
0fc9360
|
I just fixed conflicts pulling from latest |
rushatgabhane
left a comment
There was a problem hiding this comment.
@Beamanator looks good.
Gave it a sanity check after merge conflicts were fixed
Screen.Recording.2022-12-08.at.8.58.19.PM.mov
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
There is a crash caused by this PR #13473. |
|
🚀 Deployed to production by @chiragsalian in version: 1.2.38-6 🚀
|
| <ReportActionsSkeletonView | ||
| containerHeight={this.state.skeletonViewContainerHeight} | ||
| /> | ||
| <ReportFooter |
There was a problem hiding this comment.
While the report is loading, user interaction in composer is disabled. (Implemented by this commit) We have a feature request to enable composer even when the report is loading. So, @0xmiroslav @rushatgabhane I am trying to understand why was it disabled?
There was a problem hiding this comment.
@sobitneupane It was disabled intentionally. And then we changed our mind. So please feel free to enable again but many things to consider. #14223 is not simple issue.
Please check details here
There was a problem hiding this comment.
Yes, we chose to keep it disabled as it was not displayed at all before. So basically, we decided to focus on just one ticket at a time rather than open a big box of problems 😄
Details
key={this.props.report.reportID}toReportActionComposeso it re-renders whenever report changesFixed Issues
$ #11856
PROPOSAL: #11856 (comment)
Tests
NOTE: On small screen devices (mobile, mWeb), it's intended behavior to freeze screen (loading skeleton without showing composer) until drawer is fully open. But after that, composer should appear along with skeleton while loading messages.
QA Steps
NOTE: On small screen devices (mobile, mWeb), it's intended behavior to freeze screen (loading skeleton without showing composer) until drawer is fully open. But after that, composer should appear along with skeleton while loading messages.
PR Review Checklist
PR Author Checklist
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*filesWaiting 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)PR Reviewer Checklist
The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick).src/languages/*filesWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarhave been tested & I retested again)/** 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)Screenshots
Web
web.mov
Mobile Web - Chrome
mchrome.mp4
Mobile Web - Safari
msafari.mp4
Desktop
desktop.mov
iOS
ios.mp4
Android
android.mp4