Skip to content

Commit 5d25a0b

Browse files
geraldglynnshockey
authored andcommitted
improvement: add isShown check to <ModelCollapse />'s prop expanded logic (via #5331)
1 parent 96c444e commit 5d25a0b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/core/components/models.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ export default class Models extends Component {
6262

6363
const schema = Map.isMap(schemaValue) ? schemaValue : Im.Map()
6464
const rawSchema = Map.isMap(rawSchemaValue) ? rawSchemaValue : Im.Map()
65-
65+
6666
const displayName = schema.get("title") || rawSchema.get("title") || name
67+
const isShown = layoutSelectors.isShown( ["models", name], false )
6768

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

0 commit comments

Comments
 (0)