Gitea-VSCode icon indicating copy to clipboard operation
Gitea-VSCode copied to clipboard

[Bug] Element with id 72 is already registered

Open lonix1 opened this issue 4 years ago • 2 comments

vscode 1.54.1 extension 2.0.0

Hey @IJustDev, thanks for the latest version!

Now it connects, even on localhost (problem #24 seems resolved), but when I click refresh I get:

Element with id 72 is already registered

Also:

  • it places closed issues in the "Closed Issues" pane, but they are badly formatted
  • the "Open Issues" pane is empty
  • I looked for logs but couldn't find any

What could be the problem?

lonix1 avatar Mar 13 '21 07:03 lonix1

Yea we really should implement the logging, at the beginning I didn't give a shit about logging ^^ Wrong move, I guess. It may be a problem with the rendering (each element has an id and this id should be unique)

IJustDev avatar Mar 13 '21 11:03 IJustDev

A recommended fix would be to remove issues.push(...issuesOfPage); from line 32 of issueProvider.ts and replacing it with

for(let issue of issuesOfPage){

  if(!issuesID.includes(issue['id'])){

    issuesID.push(issue['id']);

    issues.push(issue);

  }

}

and adding const issuesID = []; to line 27.

What's happening is that if there is more than 10 issues, it will pull multiple pages. These pages can have issues that previous pages resulting in duplicates in the array. issuesID keeps track of what id's have already been found and prevents duplicates from being added.

berg2043 avatar Apr 13 '21 00:04 berg2043

I think the problem comes from the Gitea API which does not like the page number to be 0 (tested with Gitea 1.16.5).

Change this line with let page=1 seems to fix the problem (still testing ;))

MaxenceG2M avatar Aug 08 '22 12:08 MaxenceG2M

Tested with an undred of issues, no more problems 8)

MaxenceG2M avatar Aug 08 '22 13:08 MaxenceG2M

Hey there, sorry for the late response. I will go through it in a few hours and notify you!

IJustDev avatar Aug 17 '22 13:08 IJustDev

I still have this:

Element with id 78 is already registered

Element with id 74 is already registered

lonix1 avatar Aug 29 '22 09:08 lonix1

Yea we really should implement the logging, at the beginning I didn't give a shit about logging ^^ Wrong move, I guess. It may be a problem with the rendering (each element has an id and this id should be unique)

Definitly needed :D

I have started something very basic, I am going to propose a PR. This will help to identify the problem.

MaxenceG2M avatar Aug 30 '22 09:08 MaxenceG2M

Looking forward to that! It will help to solve this problem, and future ones too.

PS: @IJustDev I suggest to reopen this issue?

lonix1 avatar Aug 30 '22 10:08 lonix1

I just created the pull request (#45). Very basic and focused on the Gitea Connector - request to Gitea. Hope this help :/

MaxenceG2M avatar Aug 30 '22 15:08 MaxenceG2M