Skip to content

Commit

Permalink
[desk-tool] Reopen collaped panes when changing type. Fixes #260 (#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristoffer J. Sivertsen authored Feb 6, 2018
1 parent 07fb511 commit 2504461
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/@sanity/desk-tool/src/SchemaPaneResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ export default class SchemaPaneResolver extends React.Component {
collapsedPanes: []
}

componentWillReceiveProps(nextProps) {
const nextType = nextProps.router.state && nextProps.router.state.selectedType
const currentType = this.props.router.state && this.props.router.state.selectedType
if (nextType !== currentType) {
this.setState({
collapsedPanes: []
})
}
}

handleToggleDocumentsPaneMenu = () => {
this.setState({
documentPaneMenuIsOpen: !this.state.documentPaneMenuIsOpen
Expand Down

0 comments on commit 2504461

Please sign in to comment.