Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE (BUG REPORT) -- ("old") 'preview' inappropriately displays error message "TOO MANY LINKS FOR PREVIEW" #19

Open
ClaytonCurtis1947 opened this issue Feb 17, 2024 · 0 comments

Comments

@ClaytonCurtis1947
Copy link

The root of the problem is the erroneous re-use of the variable "maxLinksPreview". Its value is used as a limit in a given display cycle, rather than a global constant (like "maxNodesPreview"). Each time links are to be drawn, it is basically set to the mumber of links to be drawn and never reset to the true initial limit set at preview startup. As a result, any time the number of links to be drawn exceed the number of links drawn in the previous cycle, a factitious error is detected and the message displayed.

The problem is easily demonstrated:

  • open preview
  • select a project with some number of links (say, 5) and let it display
  • without closing preview, select a project with a larger number of links (say, 10) and let it display
  • the error message will be displayed because maxLinksPreview is set to 5 in the first instance and that number is mistakenly treated as an actual maximum in the second cycle. Since 10 exceeds 5, the error message is generated.

The fix is to use a different variable for the limit needed when a new project is selected.

Here is my solution, which has been thoroughly tested. The new variable introduced is 'maxLinksPreviewActual '.

WARNING: The solution presented is a modification of the latest code base to which I have access (August 2023). I have not been notified of a later version or been able to detect one -- if there is such, the error may have been fixed or the line numbers differ.


line# 256 - 261

<...>
// Draw Links
if (pfile["linkcount"] > maxLinksPreview) {
document.getElementById("warning").innerHTML = "TOO MANY LINKS
FOR PREVIEW";
maxLinksPreviewActual = maxLinksPreview;
}
else{
maxLinksPreviewActual = pfile["linkcount"];
}
count = 0;
for (let l = 0; l < maxLinksPreviewActual; l++) {
<...>

line# 400 - 406
<...>
// Draw Links
if (pfile["linkcount"] > maxLinksPreview) {
document.getElementById("warning").innerHTML = "TOO MANY LINKS
FOR PREVIEW";
maxLinksPreviewActual = maxLinksPreview;
}
else{
maxLinksPreviewActual = pfile["linkcount"];
}
count = 0;
for (let l = 0; l < maxLinksPreviewActual ; l++) { // this line incorporates fix to last link not displayed bug = ACC

<...>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant