baidu / baidu/amis

crud控件headerToolbar中嵌套form后,页面首次加载,里面的控件会初始化两次

Open
#4,638 1 comment 0 reactions 0 assignees View on GitHub
bug P1
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

#### 描述问题:

crud控件headtools中嵌套form后,页面首次加载,里面的控件会初始化两次

#### 截图或视频:
![image](https://user-images.githubusercontent.com/1425872/174126416-6a56df33-f958-40e4-824e-34a15bab2f1a.png)

#### 如何复现(请务必完整填写下面内容):

1. 你是如何使用 amis 的?
`sdk`、`npm` 或`其他`...

2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在

3. 粘贴有问题的完整 `amis schema` 代码:
```
{
"type": "page",
"body": [
{
"type": "crud",
"defaultParams": {
"orderBy": "msg_id",
"orderDir": "asc"
},
"primaryField": "msg_id",
"headerToolbar": [
{
"type": "form",
"mode": "inline",
"target": "datalist",
"body": [
{
"type": "select",
"label": "接口类型",
"name": "msg_type",
"mode": "inline",
"clearable": true,
"source": "/Dynamic/GetDetailList?itemCode=MsgType",
"horizontal": {
"leftFixed": "normal"
}
}
],
"submitText": "",
"wrapWithPanel": false
},
{
"type": "columns-toggler",
"align": "right"
}
],
"columns": [
{
"type": "text",
"label": "消息ID",
"name": "msg_id",
"width": 80,
"sortable": false
},
{
"type": "text",
"label": "系统账号",
"name": "sysnum",
"width": 80,
"sortable": false
},
{
"type": "text",
"label": "消息接收人",
"name": "msg_recvuser",
"width": 100,
"sortable": false
},
{
"type": "text",
"label": "消息内容",
"name": "msg_content",
"width": 300,
"sortable": false
}
],
"perPageAvailable": [
20,
50,
100
],
"draggable": false,
"perPage": 20,
"footerToolbar": [
"statistics",
"switch-per-page",
"pagination"
]
}
],
"regions": [
"body"
],
"title": ""
}
```

4. 操作步骤
请简单描述一下复现的操作步骤...

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the CRUD control's headerToolbar handling and the nested form in the provided AMIS schema. Reproduce the page's first load and trace why the nested select or other form controls initialize twice. Done means the nested controls initialize only once on the initial load.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.