Skip to content

Potential issue: Coupon list shows an infinite spinner #21

@ivansaul

Description

@ivansaul

🟡 Coupon list shows an infinite bottom loading spinner even when not loading more pages

CouponListScreen always renders an extra list item at the end as a CupertinoActivityIndicator, regardless of whether a next page fetch is in progress or whether there are more pages.

Actual behavior: the loading indicator is always visible at the bottom of the list.
Expected behavior: the loading indicator should only be shown while a pagination request is in-flight (and typically hidden once the last page is reached).

Click to expand

The list’s itemCount is set to listCoupon.length + 1, and the last index always returns the spinner:

itemCount: listCoupon.length + 1,
...
if (index == listCoupon.length) {
  return const Center(child: CupertinoActivityIndicator());
}

This has no conditional tied to controller state such as “isFetchingNextPage” / “hasMore”.

Recommendation: Track pagination state in CouponListController (e.g., isFetchingNextPage, hasMore based on totalPages), and only append/render the loading row when appropriate. Otherwise set itemCount to listCoupon.length.

Open in Devin Review

Originally posted by @devin-ai-integration[bot] in #20 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions