Skip to content

Reports/Funnels list has no deterministic ordering (renders in random order) #4323

@epklein

Description

@epklein

Describe the Bug

The list on the Funnels page (and the Reports list in general — goals, journeys, etc.) is displayed in a non-deterministic order. The order appears random and changes over time (e.g. after editing a report), making it hard to locate a specific funnel.

Steps To Reproduce

  1. Create several funnel reports for a website.
  2. Open the Funnels page.
  3. Observe the order of the listed funnels — it does not follow creation date, update date, or name.
  4. Edit one of the funnels and reload — the position of items can change.

Expected Behavior

The list should have a stable, predictable order. Sorting alphabetically by name (name asc) by default would be the most intuitive, ideally with optional sort controls (name / created / updated).

Likely Root Cause

GET /api/reports (src/app/api/reports/route.ts) calls getReports, which delegates to prisma.pagedQuery('report', ...). The route only passes page, pageSize and search as filters — no orderBy.

In pagedQuery (src/lib/prisma.ts), the orderBy clause is only applied when orderBy is truthy. Since orderBy is undefined, Prisma's findMany runs without an ORDER BY. On PostgreSQL the row order is then undefined (roughly heap/physical order), which shifts after UPDATEs/VACUUM — hence the "random" appearance.

Suggested Fix

Apply a default ordering by name in getReports. Optionally, expose sort parameters in the API/UI so users can switch between name, created date, and updated date.

Database

PostgreSQL

Relevant log output

Which Umami version are you using?

3.1.0

How are you deploying your application?

Self-hosted (Docker)

Which browser are you using?

Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed in devFixed in the dev branch

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions