Closed IuliiaHerets closed 3 weeks ago
Triggered auto assignment to @garrettmknight (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
@garrettmknight FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
On changing skin tone 6th time, emoji reduced to one. 6th skin tone also unused one. It is not used 2nd time but reduced to one emoji.
The emoji reduced to one because we choose the emoji with skinTone = 0
And we have some issues with Onyx.merge
method with array here
https://github.com/Expensify/App/blob/92171d88b709ecd2d987fab85a0b824fa1bb0cd5/src/libs/actions/Report.ts#L2513-L2523
With skinTones = {1: '2024-09-10 22:34:22', -1: '2024-09-10 22:34:30'}
and Onyx merged new skinTone = {0: '2024-09-10 22:34:39.470'}
to this existed skinTones
after that skinTones
will be {0: '2024-09-10 22:34:39.470'}
set
and we can calculate skinTones
through existingReactions
https://github.com/Expensify/App/blob/92171d88b709ecd2d987fab85a0b824fa1bb0cd5/src/libs/actions/Report.ts#L2513 onyxMethod: Onyx.METHOD.SET,
existingReactions
to function addEmojiReaction
here and pass it from toggleEmojiReaction
function addEmojiReaction(reportID: string, reportActionID: string, emoji: Emoji, skinTone: string | number = preferredSkinTone, existingReactions?: OnyxEntry<ReportActionReactions>) {
skinTones
through existingReactions
and use it in optimisticData
const skinTones =
existingReactions && existingReactions?.[emoji.name]?.users?.[currentUserAccountID]?.skinTones
? {...existingReactions?.[emoji.name]?.users?.[currentUserAccountID]?.skinTones, [skinTone ?? CONST.EMOJI_DEFAULT_SKIN_TONE]: createdAt}
: {
[skinTone ?? CONST.EMOJI_DEFAULT_SKIN_TONE]: createdAt,
};
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${reportActionID}`,
value: {
[emoji.name]: {
createdAt,
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
users: {
[currentUserAccountID]: {
skinTones: skinTones,
},
},
},
},
},
];
I don't think this is worth fixing.
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.31-14 Reproducible in staging?: Y Reproducible in production?: Y Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
On changing skin tone 6th time, emoji must not be reduced to one.
Actual Result:
On changing skin tone 6th time, emoji reduced to one. 6th skin tone also unused one. It is not used 2nd time but reduced to one emoji.
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/e8f14691-8bea-4c38-a44d-b553c6a94bc6
View all open jobs on GitHub