We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4313e29 commit 4b845ceCopy full SHA for 4b845ce
src/lib/connectAxesToLayout.js
@@ -48,9 +48,16 @@ export default function connectAxesToLayout(WrappedComponent) {
48
49
this.axes = getAllAxes(context.fullContainer);
50
this.axesOptions = computeAxesOptions(this.axes, props, context);
51
- const defaultAxesTarget = this.axesOptions.length
52
- ? this.axesOptions[0].value
53
- : null;
+
+ // this.axesOptions can be an empty array when we have a filter on an AxesFold
+ // and no axes correspond to the condition
54
+ let defaultAxesTarget = null;
55
+ if (this.axesOptions.length === 1) {
56
+ defaultAxesTarget = this.axesOptions[0].value;
57
+ }
58
+ if (this.axesOptions.length > 1) {
59
+ defaultAxesTarget = this.axesOptions[1].value;
60
61
62
this.state = {
63
axesTarget: defaultAxesTarget,
0 commit comments