Skip to content

Conversation

etpinard
Copy link
Contributor

fixes #3197

cc @plotly/plotly_js

@etpinard etpinard added bug something broken status: reviewable labels Oct 31, 2018
@etpinard
Copy link
Contributor Author

Codepen from #3197 but using a bundle off this branch: https://codepen.io/etpinard/pen/xyvGRJ

var lastptdef = srcPos.length - 2;
while(isNaN(srcPos[lastptdef]) || isNaN(srcPos[lastptdef + 1])) {
lastptdef += -2;
while(lastptdef > -1 && (isNaN(srcPos[lastptdef]) || isNaN(srcPos[lastptdef + 1]))) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even better: while(lastptdef > firstptdef && ... would skip this second loop altogether in the failing case.

BTW do we need this pos = pos.concat... thing at all? Can't we just do lineOptions.positions = srcPos.slice(...)? It's needed in the fill section below but I don't see why it'd be needed here. In fact, even that slice seems like it could be omitted when we didn't drop any points on either end.

@alexcjohnson
Copy link
Collaborator

💃

@etpinard
Copy link
Contributor Author

Thanks for the quick review @alexcjohnson !

I'll make another patch release tomorrow morning.

@etpinard etpinard merged commit c1c0d04 into master Oct 31, 2018
@etpinard etpinard deleted the catch-nan-while-loops branch October 31, 2018 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plotly 1.42.1 goes unresponsive
2 participants