fix: use stable trusted user keys#2034
Conversation
|
Thank you @, for creating the PR and contributing to our UltimateHealth project 💗. |
Automated Review FeedbackNo major issues were identified during this review. The implementation appears consistent with the repository standards and the modified files were reviewed successfully.
|
|
/review |
🤖 Gemini AI Code ReviewSummaryThis Pull Request addresses a critical issue in the While the intent and direction of the fix are excellent, there are crucial edge cases regarding the uniqueness and guaranteed presence of 🔴 High Severity
🟡 Medium Severity
🟢 Low Severity / Nits
What's Good ✅
VerdictRequest Changes. The core idea of using |
SB2318
left a comment
There was a problem hiding this comment.
@Muskan25-jssateb please consider the bot points.
|
Hi! Thank you for the review and the helpful suggestions. I noticed that the current TrustedUser type defines both _id and user_handle as required, while the issue description mentions cases where _id may be missing. Before updating the implementation further, could you please clarify whether user_handle is guaranteed to be unique, or if there is another preferred unique fallback identifier when _id is unavailable? I want to make sure the implementation aligns with the expected data contract. Thank you! |
PR Description
Fixed the unstable array index fallback used in the TrustedUsersModal FlatList keyExtractor.
Updated the keyExtractor to use 'user_handle' instead of the array index whenever '_id' is unavailable. This provides stable keys and prevents incorrect row reuse when the list changes.
Fixes #2002
Instead of using the array index as a fallback key, the component now uses 'user_handle', which provides a stable and unique key when '_id' is unavailable. This prevents incorrect row reuse when the list changes.
Type of Change
Select your work-area
Related Issue
#2002
Add your Work Example
Updated the FlatList keyExtractor to use user_handle instead of the array index as the fallback key.
Fixes (mention the issue number which this fixes)
Fixes #2002
Checklist
Undertaking
My code follows the style guidelines of this project.
I have performed a self-review of my code.
I have commented my code, particularly in hard-to-understand areas.
I have made corresponding changes to the documentation.
I have checked for plagiarism and assure its authenticity.
I have read and followed the code of conduct for this repository. I understand that violation of this undertaking may have legal consequences.
I Agree