remove duplicate request when timeline is empty (#1491)
This commit is contained in:
parent
b79e86cacd
commit
0d465d3bee
|
@ -68,7 +68,6 @@ import com.keylesspalace.tusky.view.EndlessOnScrollListener;
|
||||||
import com.keylesspalace.tusky.viewdata.StatusViewData;
|
import com.keylesspalace.tusky.viewdata.StatusViewData;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -286,12 +285,12 @@ public class TimelineFragment extends SFragment implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCurrent() {
|
private void updateCurrent() {
|
||||||
String topId;
|
|
||||||
if (this.statuses.isEmpty()) {
|
if (this.statuses.isEmpty()) {
|
||||||
topId = null;
|
return;
|
||||||
} else {
|
|
||||||
topId = CollectionsKt.first(this.statuses, Either::isRight).asRight().getId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String topId = CollectionsKt.first(this.statuses, Either::isRight).asRight().getId();
|
||||||
|
|
||||||
this.timelineRepo.getStatuses(topId, null, null, LOAD_AT_ONCE,
|
this.timelineRepo.getStatuses(topId, null, null, LOAD_AT_ONCE,
|
||||||
TimelineRequestMode.NETWORK)
|
TimelineRequestMode.NETWORK)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
@ -303,7 +302,7 @@ public class TimelineFragment extends SFragment implements
|
||||||
if (!statuses.isEmpty()) {
|
if (!statuses.isEmpty()) {
|
||||||
filterStatuses(statuses);
|
filterStatuses(statuses);
|
||||||
|
|
||||||
if (!this.statuses.isEmpty() && topId != null) {
|
if (!this.statuses.isEmpty()) {
|
||||||
// clear old cached statuses
|
// clear old cached statuses
|
||||||
Iterator<Either<Placeholder, Status>> iterator = this.statuses.iterator();
|
Iterator<Either<Placeholder, Status>> iterator = this.statuses.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
|
Loading…
Reference in New Issue