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
So I have a react-sortable-pane on a page with two items. On initialization, they are in order [0,1]. If I swap the order to [1,0], I fire off a dragStop event (orderChanged fires even if I haven't dropped, and that's not desirable). At dragStop I update the order in my app state. Everything is good.
Then I click a button which opens a right-sidebar. This causes my react-sortable-pane to reset to [0,1] order. Within componentWillReceiveProps, if I log this.props.children I see the children in the original order. If I log next.children, I see the children in the desired [1,0] order.
However, because componentWillReceiveProps is checking the arbitrary order prop, the setState({ panes: newPanes }) never gets called. If I manually call this.setSize() from within componentWillReceiveProps, the order of my panes are correct.
The problem I have is - I'm not sure how to fix this properly. Since the internals of pane order simply uses the index in an array, as opposed to something concrete like id, I can't just explicitly update the order.
Do I now have to manage the order myself and pass it in to the SortablePane component? That seems like duplicitous effort - I don't really care - I just want the order to be maintained across re-renders.
Do you have any other thoughts on this?
The text was updated successfully, but these errors were encountered:
So I have a
react-sortable-pane
on a page with two items. On initialization, they are in order[0,1]
. If I swap the order to[1,0]
, I fire off adragStop
event (orderChanged
fires even if I haven't dropped, and that's not desirable). AtdragStop
I update the order in my app state. Everything is good.Then I click a button which opens a right-sidebar. This causes my
react-sortable-pane
to reset to[0,1]
order. WithincomponentWillReceiveProps
, if I logthis.props.children
I see the children in the original order. If I lognext.children
, I see the children in the desired[1,0]
order.However, because
componentWillReceiveProps
is checking the arbitrary order prop, thesetState({ panes: newPanes })
never gets called. If I manually callthis.setSize()
from withincomponentWillReceiveProps
, the order of my panes are correct.The problem I have is - I'm not sure how to fix this properly. Since the internals of pane order simply uses the index in an array, as opposed to something concrete like
id
, I can't just explicitly update the order.Do I now have to manage the order myself and pass it in to the
SortablePane
component? That seems like duplicitous effort - I don't really care - I just want the order to be maintained across re-renders.Do you have any other thoughts on this?
The text was updated successfully, but these errors were encountered: