-
Notifications
You must be signed in to change notification settings - Fork 3k
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/18554: Update reaction dynamically in the reaction popup #18701
Conversation
@cristipaval @rushatgabhane One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@dukenv0307 kindly fix the merge conflicts |
@rushatgabhane everything is updated |
@dukenv0307 can you sign the CLA please |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-05-16.at.04.30.18.movMobile Web - ChromeScreen.Recording.2023-05-16.at.04.41.53.movMobile Web - SafariScreen.Recording.2023-05-16.at.04.42.17.movDesktopScreen.Recording.2023-05-16.at.04.35.08.movAndroidScreen.Recording.2023-05-16.at.04.49.25.mov |
@rushatgabhane Sorry about my late. I just updated, help to check again |
@rushatgabhane Bump, please help to review |
@rushatgabhane - Little bump for the PR review here the next time you're online and available. Thanks! |
Reviewing today! |
@dukenv0307 everything else looks good to me, nice work on the PR! |
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.
@cristipaval LGTM!
@dukenv0307 can you please merge with main and fix the lint errors |
@dukenv0307 we still need to fix the lint errors - there's a prettier diff. Please push it! |
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.
LGTM! @cristipaval
@cristipaval Friendly bump |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
import lodashMap from 'lodash/map'; | ||
import lodashFilter from 'lodash/filter'; | ||
import lodashFind from 'lodash/find'; | ||
import lodashEach from 'lodash/each'; | ||
import lodashIsEqual from 'lodash/isEqual'; |
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.
Using underscore is our standard to keep everything consistent: https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#object--array-methods
Please remove these and use underscore instead.
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.
lodashGet
is the only one we allow since underscore doesn't have an equivalent.
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.
@tgolen @rushatgabhane I just created PR to fix: #19183
* @param {Array} users | ||
* @return {string[]} | ||
* */ | ||
const getUniqueEmojiCodes = (emoji, users) => { |
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.
This method is now defined twice and needs to be DRYed up https://github.com/Expensify/App/blob/main/src/components/Reactions/ReportActionItemReactions.js#L24
withOnyx({ | ||
reportActions: { | ||
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, | ||
canEvict: false, |
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.
Why is this here?
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.
@rushatgabhane The PR is merged, so do we create a new PR to fix it or revert this PR?
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.
what is wrong with it tho? @dukenv0307
and about other comments, you can create a new PR to address them and tag me for a review
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.
This is an explanation about canEvict field
https://github.com/Expensify/react-native-onyx/blob/1d496b001f327c509131597faf260a81c002be77/lib/withOnyx.js#L113-L116
@tgolen @rushatgabhane I see that canEvict: false
is added when we get reportAction everywhere in App repo. So I think in here we also add it for consistency
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.
Oh. But that's not a good reason.
When I initially reviewed this, this is how I reasoned it - When storage is full, don't remove reactions from storage. Which seems reasonable to me.
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.
I'm pretty sure the eviction logic is completely broken, and I think this should just be removed, but maybe it should be there for report actions... I do see it used everywhere. @vitHoracek @marcaaron do you have any guidance on the canEvict
setting for report actions?
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.
cc @mountiny some guidance on above please
we tagged the fake @vitHoracek
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.
How did we deduce that the eviction logic was completely broken? Is there more context about that? I'm not aware of any issues with it, but perhaps it is broken.
The guidance on canEvict
is that you should pass false
if it's used for something that the UI depends on e.g. you don't want to evict report actions that are currently in view, but it is fine to remove them for a report that is not in view.
In reality, only report actions are evicted and when we set this up there weren't many places where we would disallow eviction other than the one place where we subscribed to a reportActions_<reportID>
key that was needed for the active screen's UI (i.e. the chat screen).
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.
Ok, I did some poking and all the places where it is being used look kosher to me. There is documented guidance here: https://github.com/expensify/app#storage-eviction
Open to improvements or suggestions. I think there's probably a better version of storage eviction waiting to be built at some point in all of our imaginations - but this one has gonna us pretty far. Let me know if there's anything else I can help with 🙇♂️
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.
@marcaaron The reason I believe that the eviction logic is broken is from this line here: https://github.com/Expensify/react-native-onyx/blob/main/lib/withOnyx.js#L129
When I was working with Thaibault (during ExpensiconX) and looking at migrating Onxy to TypeScript, we found that mapping.connectionID
is undefined
. This is because:
- The
connectionID
gets saved to the mapping here inOnyx.connect()
- We assume that the
mapping
there is a reference to the same mapping object that is inwithOnyx
but actually, it's a copy as we can see by the spread operator being used onmapping
here when it is passed toOnyx.connect()
checkEvictableKeys()
then looks through all the mappings inmapOnyxToState
here and referencesmapping.connectionID
. This is where it breaks 💥 because that object never hadconnectionID
saved to it, theconnectionID
was only saved to a copy of it.
🚀 Deployed to staging by https://github.com/cristipaval in version: 1.3.16-0 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
2 similar comments
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.16-7 🚀
|
const emoji = lodashFind(emojis, (e) => e.name === selectedReaction.emoji); | ||
const emojiCodes = getUniqueEmojiCodes(emoji, selectedReaction.users); | ||
const hasUserReacted = Report.hasAccountIDReacted(this.props.currentUserPersonalDetails.accountID, reactionUsers); | ||
const users = PersonalDetailsUtils.getPersonalDetailsByIDs(reactionUsers); |
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.
We missed to pass the accountID as the second param during this refractor causing this issue - #20267
Detail
We will move the logic to get information of the reaction to PopoverReactionList.js itself. So, this component could be dynamically updated
Fixed Issues
$ #18554
PROPOSAL: #18554 (comment)
Tests
Offline tests
None
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Mobile Web - Chrome
Record_2023-05-10-16-22-58.mp4
Mobile Web - Safari && IOS
Screen-Recording-2023-05-10-at-16.42.53.mp4
Desktop
iOS
In the safari section
Android
18554.mp4