Skip to content

Commit 67643f6

Browse files
Merge pull request #1872 from kamalqureshi/form_not_populating
Child element on Form not populating
2 parents d4c148f + fc128f4 commit 67643f6

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

client/packages/lowcoder/src/comps/comps/formComp/formComp.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,17 @@ const FormBaseComp = (function () {
208208
);
209209
})
210210
.setPropertyViewFn((children) => {
211+
const editorContext = useContext(EditorContext);
212+
const isLogicMode = editorContext.editorModeStatus === "logic" || editorContext.editorModeStatus === "both";
213+
const isLayoutMode = editorContext.editorModeStatus === "layout" || editorContext.editorModeStatus === "both";
214+
211215
return (
212216
<>
213217
<Section name={sectionNames.basic}>
214218
{children.resetAfterSubmit.propertyView({ label: trans("formComp.resetAfterSubmit") })}
215219
</Section>
216220

217-
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
221+
{isLogicMode && (
218222
<><Section name={sectionNames.interaction}>
219223
{children.onEvent.getPropertyView()}
220224
{disabledPropertyView(children)}
@@ -225,22 +229,22 @@ const FormBaseComp = (function () {
225229
</>
226230
)}
227231

228-
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
232+
{isLayoutMode && (
229233
<>
230234
<Section name={sectionNames.layout}>
231235
{children.container.getPropertyView()}
232236
</Section>
233237
</>
234238
)}
235239

236-
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
240+
{isLogicMode && (
237241
<Section name={sectionNames.advanced}>
238242
{children.initialData.propertyView({ label: trans("formComp.initialData") })}
239243
{children.invalidFormMessage.propertyView({ label: trans("formComp.invalidFormMessage") })}
240244
</Section>
241245
)}
242246

243-
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
247+
{isLayoutMode && (
244248
<>
245249
<Section name={sectionNames.style}>
246250
{children.container.stylePropertyView()}
@@ -383,9 +387,7 @@ let FormTmpComp = class extends FormBaseComp implements IForm {
383387
case CompActionTypes.UPDATE_NODES_V2: {
384388
const ret = super.reduce(action);
385389
// When the initial value changes, update the form
386-
if (ret.children.initialData !== this.children.initialData) {
387-
// FIXME: kill setTimeout ?
388-
setTimeout(() => {
390+
requestAnimationFrame(() => {
389391
this.dispatch(
390392
customAction<SetDataAction>(
391393
{
@@ -396,7 +398,6 @@ let FormTmpComp = class extends FormBaseComp implements IForm {
396398
)
397399
);
398400
});
399-
}
400401
return ret;
401402
}
402403
case CompActionTypes.CUSTOM:

client/packages/lowcoder/src/redux/sagas/orgSagas.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -367,13 +367,15 @@ export function* fetchWorkspacesSaga(action: ReduxAction<{page: number, pageSize
367367
const apiData = response.data.data;
368368

369369
// Transform orgId/orgName to match Org interface
370-
const transformedItems = apiData.data.map(item => ({
371-
id: item.orgView.orgId,
372-
name: item.orgView.orgName,
373-
createdAt: item.orgView.createdAt,
374-
updatedAt: item.orgView.updatedAt,
375-
isCurrentOrg: item.isCurrentOrg,
376-
}));
370+
const transformedItems = apiData.data
371+
.filter(item => item.orgView && item.orgView.orgId)
372+
.map(item => ({
373+
id: item.orgView.orgId,
374+
name: item.orgView.orgName,
375+
createdAt: item.orgView.createdAt,
376+
updatedAt: item.orgView.updatedAt,
377+
isCurrentOrg: item.isCurrentOrg,
378+
}));
377379

378380
yield put({
379381
type: ReduxActionTypes.FETCH_WORKSPACES_SUCCESS,

0 commit comments

Comments
 (0)