-
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 unchecked user becomes checked again when searching #38867
Fix unchecked user becomes checked again when searching #38867
Conversation
} | ||
newSelectedOptions.push({...detailsMap[login], isSelected: true}); | ||
}); | ||
} |
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 decided to use firstRenderRef
here instead of this init in useState
.
const [selectedOptions, setSelectedOptions] = useState<MemberForList[]>(() => Object.values(invitedEmailsToAccountIDsDraft ?? {})
.filter((accountID) => personalDetailsProp?.[accountID])
.map((accountID) => ({...OptionsListUtils.formatMemberForList(personalDetailsProp[accountID]), isSelected: true}))
);
The reason is because the personal detail data of personalDetailsProp
is not the same as inviteOptions.personalDetails
.
I first think of copying this logic:
const inviteOptions = OptionsListUtils.getMemberInviteOptions(personalDetailsProp, betas ?? [], searchTerm, excludedUsers, true);
// Update selectedOptions with the latest personalDetails and policyMembers information
const detailsMap: Record<string, MemberForList> = {};
inviteOptions.personalDetails.forEach((detail) => {
if (!detail.login) {
return;
}
detailsMap[detail.login] = OptionsListUtils.formatMemberForList(detail);
});
but I think it would be better to just use the ref.
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromemchrome.moviOS: Nativeios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
Please merge main to fix TS error |
Done |
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 snap, what happened here? I must have forgot to merge. Can we update with merge conflicts and then re-review @situchan ? Thanks. |
@AndrewGable @situchan conflicts solved |
Thanks, can you quickly re-review @situchan as this has been stale for so long? (my fault) |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.64-6 🚀
|
Details
The logic to add the saved selected user is re-triggers every time the search keyword is changed even though we only want to run it once.
Fixed Issues
$ #36350
PROPOSAL: #36350 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
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 methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.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
Android: Native
Screen.Recording.2024-03-23.at.21.48.48.mov
Android: mWeb Chrome
Screen.Recording.2024-03-23.at.21.47.53.mov
iOS: Native
Screen.Recording.2024-03-23.at.21.47.24.mov
iOS: mWeb Safari
Screen.Recording.2024-03-23.at.21.46.06.mov
MacOS: Chrome / Safari
Screen.Recording.2024-03-23.at.21.44.46.mov
MacOS: Desktop
Screen.Recording.2024-03-23.at.21.45.19.mov