Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*** For entries which are touching the Android Wear app's, start entry with `[WEAR]` too.
21.2
- [Internal] Changed a way how authenticated web view opened in the IPP flows [https://github.com/woocommerce/woocommerce-android/pull/12908]
- [*] Fixed an inconsistent state while refreshing the orders list [https://github.com/woocommerce/woocommerce-android/pull/12948]
-----
- [**][Payments] Fixed a bug when IPP onboarding was not possible to finish from the app [https://github.com/woocommerce/woocommerce-android/pull/12917]
- [*] Fixed shipping lines being editable at all states [https://github.com/woocommerce/woocommerce-android/pull/12890]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,10 @@ class OrderListViewModel @Inject constructor(
_isEmpty.removeSource(isEmpty)
_isFetchingFirstPage.removeSource(isFetchingFirstPage)
_isLoadingMore.removeSource(isLoadingMore)

_isFetchingFirstPage.value = false
_isEmpty.value = false
_isLoadingMore.value = false
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,27 @@ class OrderListViewModelTest : BaseUnitTest() {
}
//endregion

@Test
fun `when the search view is closed while a search is in progress, then isFetchingFirstPage is reset to false`() {
// Trying to simulate a quick search close
whenever(pagedListWrapper.isFetchingFirstPage).doReturn(MutableLiveData(true), MutableLiveData())

viewModel = createViewModel()

var isFetchingFirstPage: Boolean? = null
viewModel.isFetchingFirstPage.observeForever {
isFetchingFirstPage = it
}

viewModel.submitSearchOrFilter("query")
viewModel.onSearchClosed()

assertNotNull(isFetchingFirstPage)

// Check that isFetchingFirstPage is reset to default value (false) on clearLiveDataSources
assertFalse(isFetchingFirstPage!!)
}

private companion object {
const val ANY_SEARCH_QUERY = "search query"
}
Expand Down
Loading