-
Notifications
You must be signed in to change notification settings - Fork 73
[PM-11707] Fix search results update dynamically #1966
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
base: main
Are you sure you want to change the base?
[PM-11707] Fix search results update dynamically #1966
Conversation
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1966 +/- ##
=======================================
Coverage 81.29% 81.29%
=======================================
Files 822 822
Lines 52015 52014 -1
=======================================
+ Hits 42284 42286 +2
+ Misses 9731 9728 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Looks good overall, but aside from the improvements in the comments, several tests are missing for the new code.
/// Refreshes TOTP Codes for the search results. | ||
/// | ||
private func refreshTOTPCodes(searchItems: [ItemListItem]) async { | ||
guard case let .data(currentSections) = state.loadingState else { return } |
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.
🤔 Do you need this guard for the search items?
let refreshedItems = try await services.authenticatorItemRepository.refreshTotpCodes(on: searchItems) | ||
let updatedSections = currentSections.updated(with: refreshedItems) | ||
let allItems = updatedSections.flatMap(\.items) | ||
searchTotpExpirationManager?.configureTOTPRefreshScheduling(for: allItems) | ||
state.searchResults = updatedSections[0].items |
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.
🤔 You could use a similar approach as in here to reduce code duplication even though you can't use the same as the item objects and repository are different. However, you could try to centralize them by converting the protocol to a more generic one with additional generic protocols for the repositories; therefore you can have something like HasTOTPCodesSection<ItemListItem>
conformance here and move the utility to BitwardenKit
to be shared between the apps.
🎟️ Tracking
PM-11707
📔 Objective
Fix a bug where editing an item from the search results list wouldn't update it in the list. The view now subscribes to the search results instead of using a static list.
For the Authenticator, instead of repeating the search we we subscribed the view to search results.
📸 Screenshots
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes