Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a4980bb

Browse files
committed
[Fix]: #2041 form content default values
1 parent 0e5aa97 commit a4980bb

File tree

1 file changed

+18
-9
lines changed
  • client/packages/lowcoder/src/comps/comps/formComp

1 file changed

+18
-9
lines changed

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -390,15 +390,24 @@ let FormTmpComp = class extends FormBaseComp implements IForm {
390390
if (ret.children.initialData !== this.children.initialData) {
391391
// FIXME: kill setTimeout ?
392392
setTimeout(() => {
393-
this.dispatch(
394-
customAction<SetDataAction>(
395-
{
396-
type: "setData",
397-
initialData: (action.value["initialData"] as ValueAndMsg<JSONObject>).value || {},
398-
},
399-
false
400-
)
401-
);
393+
const newInitialData = (action.value["initialData"] as ValueAndMsg<JSONObject>)
394+
.value;
395+
// only setData when initialData has explicit keys.
396+
if (
397+
newInitialData &&
398+
typeof newInitialData === "object" &&
399+
Object.keys(newInitialData).length > 0
400+
) {
401+
this.dispatch(
402+
customAction<SetDataAction>(
403+
{
404+
type: "setData",
405+
initialData: newInitialData,
406+
},
407+
false
408+
)
409+
);
410+
}
402411
}, 1000);
403412
}
404413
return ret;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /