-
Notifications
You must be signed in to change notification settings - Fork 33
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
fix lingering issues from #57 following @timelyportfolio's approach #61
fix lingering issues from #57 following @timelyportfolio's approach #61
Conversation
@BigFatDog sorry to bother you, but is there any way we can get this PR merged in the next few days? I have a deadline coming up at the end of the month and it would be great to have this fixed by then. |
@joshhjacobson |
Hi there, just wanted to check in on this. Any chance you'd be able to merge this in the next day or two? If there are revisions that need to be made, please let me know. Thanks! |
I've been waiting for your response for the pending code review these days.
If we reach a conclusion, I'll do this tonight. |
My bad, I didn't realize you'd already completed a review. Where can I find that? |
Oh MY GOD! I didn't submit it... Sorry, my bad. |
src/brush/1d/brushFor.js
Outdated
] | ||
: config.dimensions[axis].yscale.range()[0]; | ||
// handle hidden axes which will not be found in dimensions | ||
let brushRangeMax = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about returning a dummy function when an axis is hidden:
if (!config.dimensions.hasOwnProperty(axis)) {
return () => {}
}
// no more check
const brushRangeMax = ...
const yScale = ...
I'm not sure yet. Still investigating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. @timelyportfolio's fix should be reserved.
In our case, my consideration is: when brushRangeMax
is null
, it may cause unexpected behavior to set brush extent:
const _brush = brushY(_selector).extent([[-15, 0], [15, brushRangeMax]]);
Therefore it returning a dummy function should be safer.
I've tested this with your original test case.
Please also don't worry this discussion would block your work. I'll merge ASAP once we have a conclusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, I see what you mean. I'll implement this change right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be online to make sure this is merged tonight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry again for my mistake. I wish it didn't delay your work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, did you want to take the following approach:
if (!config.dimensions.hasOwnProperty(axis)) {
return () => {}
}
// no more check
const brushRangeMax = ...
const yScale = ...
which leaves the code something like this:
// handle hidden axes which will not be a property of dimensions
if (!config.dimensions.hasOwnProperty(axis)) {
return () => {}
}
const brushRangeMax =
config.dimensions[axis].type === 'string'
? config.dimensions[axis].yscale.range()[
config.dimensions[axis].yscale.range().length - 1
]
: config.dimensions[axis].yscale.range()[0];
const yscale = config.dimensions[axis].yscale;
i.e. change what @timelyportfolio had done for #57?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keeping @timelyportfolio's fix unchanged.
Only adding this to the function:
const brushFor = (state, config, pc, events, brushGroup) => (
axis,
_selector
) => {
// add this line
if (!config.dimensions.hasOwnProperty(axis)) {
return () => {}
}
// the rest code remain unchanged.
const brushRangeMax = ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it
v2.2.7 has been published to deliver this PR. Thank you for your time and efforts! |
Much appreciated! |
@joshhjacobson @BigFatDog thanks so much. Sorry I missed that! |
@timelyportfolio no problem! Wouldn't have been able to figure this out without your initial fix. |
You're welcome. |
It's fine. Please don't worry about it. |
I was still having issues when an array of axes that included the rightmost axis was hidden. This gave the error
TypeError: Cannot read property 'type' of undefined
from this line inbrushFor.js
:I followed the same approach released in v2.2.5 to correct this.