Skip to content

fix(ui): ListWatch watch stream ignores pagination limit, causing workflow list to grow beyond "results per page" setting #16013

@King-cloud-git

Description

@King-cloud-git

Pre-requisites

  • I have double-checked my configuration
  • I have tested with the :latest image tag (i.e. quay.io/argoproj/workflow-controller:latest) and can confirm the issue still exists on :latest. If not, I have explained why, in detail, in my description below.
  • I have searched existing issues and could not find a match for this bug
  • I'd like to contribute the fix myself (see contributing guide)

What happened? What did you expect to happen?

This is a UI issue

Open Argo UI → Workflow List
Set "Results per page" to 5

Environment

  • Argo Workflows version: v3.7.10 (also verified on main branch — code is identical)
  • Kubernetes: AKS 1.30+

Expected behavior

Setting "results per page" to 5 should always show at most 5 workflows.

Actual behavior

The list starts at 5 but grows to 12, 30, 50+ as new workflows are created/completed in the namespace.

Root Cause

In ui/src/shared/list-watch.ts, the list() call respects the pagination limit, but the watch() SSE stream receives ALL workflow events. The mergeItem() function pushes ADDED items without trimming to the limit:

// mergeItem — pushes without limit enforcement
} else {
    items.push(item);  // ← grows unbounded
}

The watchFields() in workflows-service.ts doesn't accept or pass a limit parameter — it watches all events regardless of pagination

Proposed fix
Add a limit parameter to ListWatch and trim this.items after each mergeItem() + sort():

// In the watch callback (list-watch.ts)
e => {
    this.items = mergeItem(e.object, e.type, this.items).sort(sorter);
    if (this.limit > 0 && this.items.length > this.limit) {
        this.items = this.items.slice(0, this.limit);
    }
    onChange(this.items, e.object, e.type);
}

Pass pagination.limit from workflows-list.tsx to the ListWatch constructor.


### Version(s)

Argo workflows v3.7.10 - Kubernetes: AKS 1.30+

### Paste a minimal workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflow that uses private images.

```YAML
Steps to reproduce
Open Argo UI  Workflow List
Set "Results per page" to 5
Submit or wait for new workflows to appear
Observe the list growing past 5

Logs from the workflow controller

kubectl logs -n argo deploy/workflow-controller | grep ${workflow}

Logs from in your workflow's wait container

kubectl logs -n argo -c wait -l workflows.argoproj.io/workflow=${workflow},workflow.argoproj.io/phase!=Succeeded

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions