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

Fix regression on recursion logic not using correct defaultProps #64

Merged
merged 1 commit into from
May 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/utils/resolveXYScales.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export default function resolveXYScales(ComposedComponent) {
static getSpacing = ComposedComponent.getSpacing;
static getDomain = ComposedComponent.getDomain;
static getMargin = ComposedComponent.getMargin;
static defaultProps = ComposedComponent.defaultProps;

_resolveScaleType(props, Component) {
let { xScaleType, yScaleType } = props;
Expand Down Expand Up @@ -318,11 +319,7 @@ export default function resolveXYScales(ComposedComponent) {
}
}

if (!isDone()) {
console.warn(
`resolveXYScales was unable to resolve both domains. xDomain: ${xDomain}, yDomain: ${yDomain}`
);
} else {
if (isDone()) {
if (includeXZero && !_.inRange(0, ...xDomain)) {
// If both are negative set max of domain to 0
if (xDomain[0] < 0 && xDomain[1] < 0) {
Expand All @@ -342,6 +339,13 @@ export default function resolveXYScales(ComposedComponent) {
}
}

// TODO handle resolveXYScales not calculating the domain
// Because this is recursive on its children it will log this warn for children missing domain
// even though it is later inferred by parent later during the recursion
// if (!isDone()) {
// console.warn(`resolveXYScales was unable to resolve both domains. xDomain: ${xDomain}, yDomain: ${yDomain}`);
// }

return { xDomain, yDomain };
}

Expand Down