Skip to content

Commit 5e5f73c

Browse files
authored
Merge pull request #724 from raheeliftikhar5/fix_modal_comps_invisible
Components become invisible on adding in modal/drawer
2 parents eb3854b + 8d6bf63 commit 5e5f73c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

client/packages/lowcoder/src/layout/gridLayout.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,25 @@ class GridLayout extends React.Component<GridLayoutProps, GridLayoutState> {
172172
}
173173

174174
componentDidUpdate(prevProps: GridLayoutProps, prevState: GridLayoutState) {
175-
const uiLayout = this.getUILayout();
176175
if (!draggingUtils.isDragging()) {
177176
// log.debug("render. clear ops. layout: ", uiLayout);
178177
// only change in changeHs, don't change state
179178
if (_.size(this.state.ops) > 0) {
180-
this.setState({ layout: uiLayout, changedHs: undefined, ops: undefined });
179+
// temporary fix for components becomes invisible in drawer/modal
180+
// TODO: find a way to call DELETE_ITEM operation after layouts are updated in state
181+
const ops = [...this.state.ops as any[]];
182+
const [firstOp] = ops;
183+
const { droppingItem } = this.props;
184+
if(
185+
ops.length === 1
186+
&& firstOp.type === 'DELETE_ITEM'
187+
&& firstOp.key === droppingItem?.i
188+
) {
189+
this.setState({ changedHs: undefined, ops: undefined });
190+
} else {
191+
const uiLayout = this.getUILayout();
192+
this.setState({ layout: uiLayout, changedHs: undefined, ops: undefined })
193+
}
181194
}
182195
}
183196
if (!draggingUtils.isDragging() && _.isNil(this.state.ops)) {

0 commit comments

Comments
 (0)