Skip to content

Commit

Permalink
[desk-tool] Pass child item id to panes
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Nov 19, 2019
1 parent ba1469b commit d1f076b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/@sanity/desk-tool/src/DeskToolPanes.js
Expand Up @@ -205,6 +205,7 @@ export default class DeskToolPanes extends React.Component {
const {isMobile} = this.state
const path = []

const paneKeys = ['root'].concat(keys)
const paneGroups = [[{id: 'root'}]].concat(routerPanes || [])

let i = -1
Expand All @@ -217,8 +218,10 @@ export default class DeskToolPanes extends React.Component {
}

const isCollapsed = Boolean(!isMobile && this.state.collapsedPanes[i])
const paneKey = `${i}-${keys[i - 1] || 'root'}-${groupIndexes[i - 1]}`
const itemId = keys[Math.max(0, i - 1)]
const paneKey = `${i}-${paneKeys[i] || 'root'}-${groupIndexes[i - 1]}`

const itemId = paneKeys[i]
const childItemId = paneKeys[i + 1]

// Same pane might appear multiple times, so use index as tiebreaker
const wrapperKey = pane === LOADING_PANE ? `loading-${i}` : `${i}-${pane.id}`
Expand Down Expand Up @@ -255,6 +258,7 @@ export default class DeskToolPanes extends React.Component {
paneKey={paneKey}
index={i}
itemId={itemId}
childItemId={childItemId}
onExpand={this.handlePaneExpand}
onCollapse={this.handlePaneCollapse}
isCollapsed={isCollapsed}
Expand Down

0 comments on commit d1f076b

Please sign in to comment.