@@ -208,13 +208,17 @@ const FormBaseComp = (function () {
208
208
);
209
209
})
210
210
.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
+
211
215
return (
212
216
<>
213
217
<Section name={sectionNames.basic}>
214
218
{children.resetAfterSubmit.propertyView({ label: trans("formComp.resetAfterSubmit") })}
215
219
</Section>
216
220
217
- {(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
221
+ {isLogicMode && (
218
222
<><Section name={sectionNames.interaction}>
219
223
{children.onEvent.getPropertyView()}
220
224
{disabledPropertyView(children)}
@@ -225,22 +229,22 @@ const FormBaseComp = (function () {
225
229
</>
226
230
)}
227
231
228
- {(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
232
+ {isLayoutMode && (
229
233
<>
230
234
<Section name={sectionNames.layout}>
231
235
{children.container.getPropertyView()}
232
236
</Section>
233
237
</>
234
238
)}
235
239
236
- {(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
240
+ {isLogicMode && (
237
241
<Section name={sectionNames.advanced}>
238
242
{children.initialData.propertyView({ label: trans("formComp.initialData") })}
239
243
{children.invalidFormMessage.propertyView({ label: trans("formComp.invalidFormMessage") })}
240
244
</Section>
241
245
)}
242
246
243
- {(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
247
+ {isLayoutMode && (
244
248
<>
245
249
<Section name={sectionNames.style}>
246
250
{children.container.stylePropertyView()}
@@ -383,9 +387,7 @@ let FormTmpComp = class extends FormBaseComp implements IForm {
383
387
case CompActionTypes.UPDATE_NODES_V2: {
384
388
const ret = super.reduce(action);
385
389
// When the initial value changes, update the form
386
- if (ret.children.initialData !== this.children.initialData) {
387
- // FIXME: kill setTimeout ?
388
- setTimeout(() => {
390
+ requestAnimationFrame(() => {
389
391
this.dispatch(
390
392
customAction<SetDataAction>(
391
393
{
@@ -396,7 +398,6 @@ let FormTmpComp = class extends FormBaseComp implements IForm {
396
398
)
397
399
);
398
400
});
399
- }
400
401
return ret;
401
402
}
402
403
case CompActionTypes.CUSTOM:
0 commit comments