[Bug] Element with id 72 is already registered
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?
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)
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.
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 ;))
Tested with an undred of issues, no more problems 8)
Hey there, sorry for the late response. I will go through it in a few hours and notify you!
I still have this:
Element with id 78 is already registered
Element with id 74 is already registered
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.
Looking forward to that! It will help to solve this problem, and future ones too.
PS: @IJustDev I suggest to reopen this issue?
I just created the pull request (#45). Very basic and focused on the Gitea Connector - request to Gitea. Hope this help :/