Skip to content

feat: [BE] Add pagination to published components endpoint #179

@Mbeaulne

Description

@Mbeaulne

Description

The GET /api/published_components/ endpoint currently returns all components with no pagination. There are existing TODO comments in the code acknowledging this:

# TODO: Implement paging
# TODO: Implement filtering/search
# TODO: Implement visibility/access control

As the component library grows and a Components tab is added to the homepage, this needs pagination support.

Part of TangleML/tangle-ui#1963

Implementation

Follow the same pagination pattern used by GET /api/pipeline_runs/:

  • Add page_size query param (default 20)
  • Add page_token query param for cursor-based pagination (base64-encoded offset)
  • Add next_page_token to response
  • Add total_count to response (component count is much smaller than runs, so a full count is fine here)

Response change

@dataclasses.dataclass(kw_only=True)
class ListPublishedComponentsResponse:
    published_components: list[PublishedComponentResponse]
    next_page_token: str | None = None  # NEW
    total_count: int | None = None      # NEW

Relevant file

  • component_library_api_server.pylist() method

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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