Skip to content

Commit

Permalink
[desk-tool] Always pass urlParameters to pane
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 24, 2019
1 parent a136f41 commit 74c3ce9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/@sanity/desk-tool/src/utils/resolvePanes.js
Expand Up @@ -68,10 +68,18 @@ function resolveForStructure(structure, paneSegments, prevStructure, fromIndex)
subscribeForUpdates(parent.child, index, context, [id, context])
}

function withUrlParameters(result, urlParameters) {
return urlParameters ? {...result, urlParameters} : result
}

function subscribeForUpdates(pane, index, context, resolverArgs) {
const {parameters} = context
const source = serializeStructure(pane, context, resolverArgs)
subscriptions.push(
source.subscribe(result => emit(result, index), error => subscriber.error(error))
source.subscribe(
result => emit(withUrlParameters(result, parameters), index),
error => subscriber.error(error)
)
)
}

Expand Down

0 comments on commit 74c3ce9

Please sign in to comment.