Skip to content

Commit

Permalink
improvement: add isShown check to <ModelCollapse />'s prop `expande…
Browse files Browse the repository at this point in the history
…d` logic (via #5331)
geraldglynn authored and shockey committed May 16, 2019

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 96c444e commit 5d25a0b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/components/models.jsx
Original file line number Diff line number Diff line change
@@ -62,10 +62,11 @@ export default class Models extends Component {

const schema = Map.isMap(schemaValue) ? schemaValue : Im.Map()
const rawSchema = Map.isMap(rawSchemaValue) ? rawSchemaValue : Im.Map()

const displayName = schema.get("title") || rawSchema.get("title") || name
const isShown = layoutSelectors.isShown( ["models", name], false )

if(layoutSelectors.isShown(["models", name], false) && (schema.size === 0 && rawSchema.size > 0)) {
if( isShown && (schema.size === 0 && rawSchema.size > 0) ) {
// Firing an action in a container render is not great,
// but it works for now.
this.props.specActions.requestResolvedSubtree([...this.getSchemaBasePath(), name])
@@ -100,7 +101,7 @@ export default class Models extends Component {
displayName={displayName}
modelName={name}
hideSelfOnExpand={true}
expanded={defaultModelsExpandDepth > 1}
expanded={ defaultModelsExpandDepth > 0 && isShown }
>{content}</ModelCollapse>
</div>
}).toArray()

0 comments on commit 5d25a0b

Please sign in to comment.