Skip to content

Bug in the IssuesTable component #208

Open
@PedroHPAlmeida

Description

@PedroHPAlmeida

In line 68 of the IssuesTable.tsx file a check is made to assign the variable projectId the value of project_id (if it was passed as a parameter to the component), otherwise the value of the id attribute of the projectDetails object is passed.

const { value, loading, error } = useAsync(async (): Promise<{
    data: IssueObject[];
    projectName: string;
    }> => {
        let projectDetails: any = await GitlabCIAPI.getProjectDetails(project_slug);
        let projectId = project_id ? project_id : projectDetails?.id; // Line 68
        let projectName = await GitlabCIAPI.getProjectName(projectId);
        const gitlabIssuesObject = await GitlabCIAPI.getIssuesSummary(project_id); // Line 70 - The error occurs here
        const data = gitlabIssuesObject?.getIssuesData;
        let renderData: any = { data, projectName };
        
        return renderData;
}, []);

The error occurs when the project_id parameter is not passed to the component and on line 70 the request is made by passing an undefined value. This happens when the catalog-info.yaml file has only the gitlab.com/project-slug annotation.
The solution is simple: just pass the variable projectId (not project_id) when calling the API, as is done in other components such as PipelinesTable.tsx.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions