architecture-samples icon indicating copy to clipboard operation
architecture-samples copied to clipboard

SwipeRefreshLayout.setOnRefreshListener should force update

Open kassim opened this issue 7 years ago • 1 comments

on todo-mvp-kotlin and todo-mvp-rxjava the TasksFragment's SwipeRefreshLayout.setOnRefreshListener call always has { presenter.loadTasks(forceUpdate = false) }

I'm wondering if I'm misunderstanding the code but wouldn't you expect a "pull to refresh" action to query the network?

kassim avatar Nov 07 '18 18:11 kassim

You're right to question that behavior — your understanding is valid.

In both todo-mvp-kotlin and todo-mvp-rxjava, the call:

swipeRefreshLayout.setOnRefreshListener { presenter.loadTasks(forceUpdate = false) } should indeed use forceUpdate = true.

Why? Pull-to-refresh is explicit user intent to refresh data. So it should bypass any cached or local data and force a fresh fetch from the source (typically network or latest data provider).

Correct usage: Update it to:

swipeRefreshLayout.setOnRefreshListener { presenter.loadTasks(forceUpdate = true) } Summary: Yes — the issue is valid. The current implementation contradicts standard UX expectations. A pull-to-refresh should always invoke a forced update.

VaradGupta23 avatar Jul 21 '25 11:07 VaradGupta23