Skip to content

Commit 19f48b4

Browse files
chore(orchestrator-form): add changeset for hidden gaps
Document the ui:hidden layout fix for the orchestrator form react package. Made-with: Cursor
1 parent ef85798 commit 19f48b4

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-orchestrator-form-react': patch
3+
---
4+
5+
Avoid layout gaps for `ui:hidden` custom widgets by skipping grid items while
6+
keeping hidden widgets mounted.

workspaces/orchestrator/plugins/orchestrator-form-react/src/components/HiddenObjectFieldTemplate.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const HiddenObjectFieldTemplate = (
101101
/>
102102
)}
103103
<Grid container spacing={2} style={{ marginTop: '10px' }}>
104-
{properties.map((element, index) => {
104+
{properties.map(element => {
105105
const hiddenCondition = getHiddenCondition(uiSchema, element.name);
106106
const isHiddenByCondition =
107107
hiddenCondition !== undefined
@@ -111,14 +111,19 @@ const HiddenObjectFieldTemplate = (
111111

112112
return isHidden ? (
113113
<div
114-
key={index}
114+
key={element.name}
115115
style={{ display: 'none' }}
116116
data-hidden-field="true"
117117
>
118118
{element.content}
119119
</div>
120120
) : (
121-
<Grid item xs={12} key={index} style={{ marginBottom: '10px' }}>
121+
<Grid
122+
item
123+
xs={12}
124+
key={element.name}
125+
style={{ marginBottom: '10px' }}
126+
>
122127
{element.content}
123128
</Grid>
124129
);

0 commit comments

Comments
 (0)