-
Notifications
You must be signed in to change notification settings - Fork 53
Description
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:
| .data(beeswarmData) |
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:
nextstrain.org/static-site/components/list-resources/modal_draw.js
Lines 97 to 119 in a1f44b8
| 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; | |
| } | |
| } |