-
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: 23735 Web - App displays single report in LHN for some time on login with that report link #24204
Merged
Merged
Fix: 23735 Web - App displays single report in LHN for some time on login with that report link #24204
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import React from 'react'; | |
import {View} from 'react-native'; | ||
import _ from 'underscore'; | ||
import PropTypes from 'prop-types'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import styles from '../../../styles/styles'; | ||
import * as StyleUtils from '../../../styles/StyleUtils'; | ||
import ONYXKEYS from '../../../ONYXKEYS'; | ||
|
@@ -36,6 +37,8 @@ import KeyboardShortcut from '../../../libs/KeyboardShortcut'; | |
import onyxSubscribe from '../../../libs/onyxSubscribe'; | ||
import personalDetailsPropType from '../../personalDetailsPropType'; | ||
import * as ReportActionContextMenu from '../report/ContextMenu/ReportActionContextMenu'; | ||
import withCurrentReportID from '../../../components/withCurrentReportID'; | ||
import OptionRowLHNData from '../../../components/LHNOptionsList/OptionRowLHNData'; | ||
|
||
const basePropTypes = { | ||
/** Toggles the navigation menu open and closed */ | ||
|
@@ -59,6 +62,15 @@ const propTypes = { | |
|
||
priorityMode: PropTypes.oneOf(_.values(CONST.PRIORITY_MODE)), | ||
|
||
/** The top most report id */ | ||
currentReportID: PropTypes.string, | ||
|
||
/* Onyx Props */ | ||
report: PropTypes.shape({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
/** reportID (only present when there is a matching report) */ | ||
reportID: PropTypes.string, | ||
}), | ||
|
||
...withLocalizePropTypes, | ||
}; | ||
|
||
|
@@ -67,6 +79,8 @@ const defaultProps = { | |
avatar: '', | ||
}, | ||
priorityMode: CONST.PRIORITY_MODE.DEFAULT, | ||
currentReportID: '', | ||
report: {}, | ||
}; | ||
|
||
class SidebarLinks extends React.PureComponent { | ||
|
@@ -161,6 +175,8 @@ class SidebarLinks extends React.PureComponent { | |
} | ||
|
||
render() { | ||
const viewMode = this.props.priorityMode === CONST.PRIORITY_MODE.GSD ? CONST.OPTION_MODE.COMPACT : CONST.OPTION_MODE.DEFAULT; | ||
|
||
return ( | ||
<View style={[styles.flex1, styles.h100]}> | ||
<View | ||
|
@@ -213,14 +229,24 @@ class SidebarLinks extends React.PureComponent { | |
</PressableWithoutFeedback> | ||
</View> | ||
{this.props.isLoading ? ( | ||
<OptionsListSkeletonView shouldAnimate /> | ||
<> | ||
{this.props.report.reportID && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use lodashGet for reportID |
||
<OptionRowLHNData | ||
reportID={this.props.currentReportID} | ||
viewMode={viewMode} | ||
shouldDisableFocusOptions={this.props.isSmallScreenWidth} | ||
onSelectRow={this.showReportPage} | ||
/> | ||
)} | ||
<OptionsListSkeletonView shouldAnimate /> | ||
</> | ||
) : ( | ||
<LHNOptionsList | ||
contentContainerStyles={[styles.sidebarListContainer, {paddingBottom: StyleUtils.getSafeAreaMargins(this.props.insets).marginBottom}]} | ||
data={this.props.optionListItems} | ||
onSelectRow={this.showReportPage} | ||
shouldDisableFocusOptions={this.props.isSmallScreenWidth} | ||
optionMode={this.props.priorityMode === CONST.PRIORITY_MODE.GSD ? CONST.OPTION_MODE.COMPACT : CONST.OPTION_MODE.DEFAULT} | ||
optionMode={viewMode} | ||
/> | ||
)} | ||
</View> | ||
|
@@ -230,5 +256,15 @@ class SidebarLinks extends React.PureComponent { | |
|
||
SidebarLinks.propTypes = propTypes; | ||
SidebarLinks.defaultProps = defaultProps; | ||
export default compose(withLocalize, withCurrentUserPersonalDetails, withWindowDimensions)(SidebarLinks); | ||
export default compose( | ||
withLocalize, | ||
withCurrentUserPersonalDetails, | ||
withWindowDimensions, | ||
withCurrentReportID, | ||
withOnyx({ | ||
report: { | ||
key: ({currentReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${currentReportID}`, | ||
}, | ||
}), | ||
)(SidebarLinks); | ||
export {basePropTypes}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Missing a code comment explaining that prop.