Skip to content

Listing previous versions fails for some datasets #1252

@tsibley

Description

@tsibley

Navigate to https://nextstrain.org/pathogens?filter=ncov (for example).

Click on one of the many "turn back the clock" links with an n= in several hundreds, e.g. ncov/gisaid/africa/1m's "every few days (n=455)". Note that it opens the previous versions modal as expected. Close the modal.

Click on one of the same "turn back the clock" links with a higher n=, e.g. ncov/gisaid/africa/2m's n=616 or …/6m's n=1119. Note that it crashes the list resources component with the error:

Something isn't working! Error: `Unknown error (thrown value was not an InternalError)`

Reproducing this locally, I see the underlying error is:

TypeError: can't access property Symbol.iterator, items is undefined

from inside d3 and implicates our code at:

This points to beeswarmData being undefined, which makes sense as possible since it starts as undefined and may not ever be defined before the iterative sizing algorithm gives up:

let beeswarmData;
let beeswarmHeight = 0;
let spareHeight = availBeeswarmHeight - beeswarmHeight - radius;
const maxIter = 5;
const radiusJump = 2;
while (iterCount++ < maxIter && spareHeight > 50) {
const nextBeeswarmData = dodge(flatData, {
radius: nextRadius * 2 + padding,
x: (d) => x(d["date"]),
});
const nextBeeswarmHeight = d3.max(nextBeeswarmData.map((d) => d.y));
const nextSpareHeight =
availBeeswarmHeight - nextBeeswarmHeight - nextRadius;
if (nextSpareHeight <= spareHeight && nextSpareHeight > 0) {
beeswarmData = nextBeeswarmData;
beeswarmHeight = nextBeeswarmHeight;
spareHeight = nextSpareHeight;
radius = nextRadius;
nextRadius += radiusJump;
} else {
nextRadius -= radiusJump;
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions