Skip to content

Commit

Permalink
[fix]: proper fix of clearing logs
Browse files Browse the repository at this point in the history
  • Loading branch information
F0x1d committed Jul 13, 2024
1 parent aa4be24 commit 67d35da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ class LogsFragment: BaseViewModelFragment<LogsViewModel, FragmentLogsBinding>()
}
setClickListenerOn(R.id.clear_item) {
requireContext().sendService<LoggingService>(action = LoggingService.ACTION_CLEAR_LOGS)
updateLogsList(null)
}
setClickListenerOn(R.id.restart_logging_item) {
requireContext().sendService<LoggingService>(action = LoggingService.ACTION_RESTART_LOGGING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ class LogsViewModel @Inject constructor(
LogsData(logs, filters, query, paused)
}.scan(LogsData()) { accumulator, data ->
when {
!data.paused -> data
!data.paused
// In case they were cleared
|| data.logs.isEmpty() -> data

data.query != accumulator.query
|| data.filters != accumulator.filters
|| data.logs.isNotEmpty() // Logs were cleared
-> data.copy(
logs = accumulator.logs,
)
Expand Down

0 comments on commit 67d35da

Please sign in to comment.