Skip to content

Commit 969ee24

Browse files
authored
Merge pull request #39368 from ZhenjaHorbach/shortcut-workspace-avatar-next-to-request-shortcut-does-not-update-when-it-is-changed
Shortcut - Workspace avatar next to request shortcut does not update when it is changed
2 parents 9d00358 + 9adb9ef commit 969ee24

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ const policySelector = (policy) =>
3737
role: policy.role,
3838
isPolicyExpenseChatEnabled: policy.isPolicyExpenseChatEnabled,
3939
pendingAction: policy.pendingAction,
40+
avatar: policy.avatar,
41+
name: policy.name,
4042
};
4143

4244
const getQuickActionIcon = (action) => {
@@ -153,13 +155,17 @@ function FloatingActionButtonAndPopover(props) {
153155

154156
const quickActionReport = useMemo(() => (props.quickAction ? ReportUtils.getReport(props.quickAction.chatReportID) : 0), [props.quickAction]);
155157

158+
const quickActionPolicy = props.allPolicies ? props.allPolicies[`${ONYXKEYS.COLLECTION.POLICY}${quickActionReport.policyID}`] : undefined;
159+
156160
const quickActionAvatars = useMemo(() => {
157161
if (quickActionReport) {
158162
const avatars = ReportUtils.getIcons(quickActionReport, props.personalDetails);
159163
return avatars.length <= 1 || ReportUtils.isPolicyExpenseChat(quickActionReport) ? avatars : _.filter(avatars, (avatar) => avatar.id !== props.session.accountID);
160164
}
161165
return [];
162-
}, [props.personalDetails, props.session.accountID, quickActionReport]);
166+
// Policy is needed as a dependency in order to update the shortcut details when the workspace changes
167+
// eslint-disable-next-line react-hooks/exhaustive-deps
168+
}, [props.personalDetails, props.session.accountID, quickActionReport, quickActionPolicy]);
163169

164170
const quickActionTitle = useMemo(() => {
165171
const titleKey = getQuickActionTitle(props.quickAction && props.quickAction.action);

0 commit comments

Comments
 (0)