You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding two or more panes at once, the internal order of panes can be reversed, leading to reversed splitter behavior (ex: drag left, splitter goes right), and a bunch of other weird issues.
When adding a new pane, Pane.onPaneAdd finds the position of the pane's dom element in the parent node.
This works when only one new panel is being added.
In my case, I have 3 panels, two of which are hidden when the page width is too small:
when largePage changes to true, both of the first two panes are added to the dom, and whenPaneAdd is fired twice by the Pane component's mount hook.
I don't think there's a guaranteed order for this, behavior, so the middle pane in my case fires first.
At this time, the this.panes array contains only one pane.
it finds the index correctly (1), but assumes that the rest of the pane array is otherwise complete, and inserts it into the panes array at position 1, with index 1, after the existing pane.
Then, whenPaneAdd fires for the left-most pane, and adds it at position 1
Now the pane orders are [0, 2, 1]. The indexes are then updated with:
this.panes.forEach((p, i) => (p.index = i))
And dragging the splitter between the second and third panes gives reversed behavior.
As a workaround, I'm doing the following:
Extending Pane to add the pane's ID to the dom element:
When adding two or more panes at once, the internal order of panes can be reversed, leading to reversed splitter behavior (ex: drag left, splitter goes right), and a bunch of other weird issues.
When adding a new pane,
Pane.onPaneAdd
finds the position of the pane's dom element in the parent node.This works when only one new panel is being added.
In my case, I have 3 panels, two of which are hidden when the page width is too small:
when
largePage
changes to true, both of the first two panes are added to the dom, andwhenPaneAdd
is fired twice by the Pane component's mount hook.I don't think there's a guaranteed order for this, behavior, so the middle pane in my case fires first.
At this time, the
this.panes
array contains only one pane.it finds the index correctly (1), but assumes that the rest of the pane array is otherwise complete, and inserts it into the panes array at position 1, with index 1, after the existing pane.
Then,
whenPaneAdd
fires for the left-most pane, and adds it at position 1Now the pane orders are [0, 2, 1]. The indexes are then updated with:
And dragging the splitter between the second and third panes gives reversed behavior.
As a workaround, I'm doing the following:
Extending Pane to add the pane's ID to the dom element:
Extending Splitpanes to change the ordering behavior
The text was updated successfully, but these errors were encountered: