Skip to content

Commit

Permalink
fix workspace avatar it not updated
Browse files Browse the repository at this point in the history
  • Loading branch information
hungvu193 committed May 29, 2023
1 parent 0c44fed commit c6f3b20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ class ReportScreen extends React.Component {
const shouldAnimate = !shouldFreeze;
const parentReportAction = ReportActionsUtils.getParentReportAction(this.props.report);
const isSingleTransactionView = ReportActionsUtils.isTransactionThread(parentReportAction);
const policy = this.props.policies[`${ONYXKEYS.COLLECTION.POLICY}${this.props.report.policyID}`];

return (
<ScreenWrapper style={screenWrapperStyle}>
<Freeze
Expand Down Expand Up @@ -340,6 +342,7 @@ class ReportScreen extends React.Component {
isComposerFullSize={this.props.isComposerFullSize}
isDrawerOpen={this.props.isDrawerOpen}
parentViewHeight={this.state.skeletonViewContainerHeight}
policy={policy}
/>
)}

Expand Down
10 changes: 10 additions & 0 deletions src/pages/home/report/ReportActionsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@ const propTypes = {
/** Information about the network */
network: networkPropTypes.isRequired,

/** Policy values needed in the component */
policy: PropTypes.shape({
avatar: PropTypes.string,
}),

...windowDimensionsPropTypes,
...withDrawerPropTypes,
...withLocalizePropTypes,
};

const defaultProps = {
reportActions: [],
policy: {},
};

class ReportActionsView extends React.Component {
Expand Down Expand Up @@ -120,6 +126,10 @@ class ReportActionsView extends React.Component {
}

shouldComponentUpdate(nextProps, nextState) {
if (lodashGet(this.props, 'policy.avatar') !== lodashGet(nextProps, 'policy.avatar')) {
return true;
}

if (!_.isEqual(nextProps.reportActions, this.props.reportActions)) {
this.mostRecentIOUReportActionID = ReportActionsUtils.getMostRecentIOURequestActionID(nextProps.reportActions);
return true;
Expand Down

0 comments on commit c6f3b20

Please sign in to comment.