Skip to content

Pagination issue with listing conversations #21

@anteksiler

Description

@anteksiler

Claude actually pointed out the bug as such:

Both searchConversations and structuredConversationFilter have a cursor parameter defined in the schema but it's never used — the code always hardcodes page: 1:

  const baseParams: Record<string, unknown> = {                                                                                                                                                                      
    page: 1,  // <-- always 1, cursor is ignored                                                                                                                                                                     
    size: input.limit,                                                                                                                                                                                               
    sortField: input.sort,                                                                                                                                                                                           
    sortOrder: input.order,                                                                                                                                                                                          
  }; 

solution:

const pageNum = input.cursor                                                                                                                                                                                       
    ? new URL(input.cursor).searchParams.get('page')                                                                                                                                                                 
    : 1;
                                                                                                                                                                                                                     
  const baseParams = {                                                                                                                                                                                             
    page: parseInt(pageNum) || 1,
    size: input.limit,
    ...                                                                                                                                                                                                              
  };

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