Skip to content
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 show only personal setting not updating the view immediately #1238

Conversation

sunkup
Copy link
Member

@sunkup sunkup commented Jan 14, 2025

Purpose

Fix show only personal setting not updating the view.

Short description

  • AccountSettings: Split pair of show only personal settings (grouped in a single data class before)
  • Remove/Replace deprecated getShowOnlyPersonalPair method
  • AccountScreen, AccountScreenModel and GetServiceCollectionPagerUseCase: Create and consume showOnlyPersonal settings separately
  • use viewModelScope instead of CoroutineScope(Dispatchers.Default)
  • GetServiceCollectionPagerUseCase: Fix showOnlyPersonal flow state change not triggering re-emission
    • Note: The problem was that we used flatMapConcat which waits for the inner flow to finish before emitting new values even if showOnlyPersonalFlow emitted new values. Now we are using flatMapLatest which will cancel the inner flow instead of waiting. Note also that using flattenMerge would also work, but probably creates unnecessary overhead as it continuously merges emits from both the inner and outer flow, which we don't need.

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

@sunkup sunkup added the bug Something isn't working label Jan 14, 2025
@sunkup sunkup self-assigned this Jan 14, 2025
@sunkup sunkup force-pushed the 1231-ui-show-only-personal-is-only-effective-when-opening-collection-list-again branch from ad96c46 to c527b85 Compare January 14, 2025 13:52
@sunkup sunkup changed the title Show only personal Fix show only personal setting not updating the view immediately Jan 14, 2025
@sunkup sunkup requested a review from ArnyminerZ January 14, 2025 14:14
@sunkup sunkup marked this pull request as ready for review January 14, 2025 14:14
@sunkup sunkup requested a review from rfc2822 January 20, 2025 10:52
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good & works in what I have tested 👍🏻

@rfc2822 rfc2822 merged commit 1cc9b4b into main-ose Jan 20, 2025
11 checks passed
@rfc2822 rfc2822 deleted the 1231-ui-show-only-personal-is-only-effective-when-opening-collection-list-again branch January 20, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UI] "Show only personal" is only effective when opening collection list again
2 participants