The fetch trait doesn't execute when the dependent states first time changed
MrWindlike opened this issue · 3 comments
MrWindlike commented
Version
0.5.6
Reproduction JSON schema
{
"version": "sunmao/v1",
"kind": "Application",
"metadata": {
"name": "some App"
},
"spec": {
"components": [
{
"id": "table6",
"type": "arco/v1/table",
"properties": {
"columns": [
{
"title": "Name",
"dataIndex": "name",
"sorter": true,
"sortDirections": [
"ascend",
"descend"
],
"type": "text",
"filter": true,
"displayValue": ""
},
{
"title": "Salary",
"dataIndex": "salary",
"sorter": true,
"filter": false,
"type": "text",
"displayValue": "",
"btnCfg": {
"text": ""
}
},
{
"title": "Time",
"dataIndex": "time",
"sorter": true,
"filter": false,
"type": "text",
"displayValue": ""
},
{
"title": "Link",
"dataIndex": "link",
"type": "link",
"filter": true,
"sorter": false,
"displayValue": ""
},
{
"title": "CustomComponent",
"dataIndex": "customComponent",
"type": "module",
"filter": false,
"sorter": false,
"module": {
"id": "clistItemName-{{$listItem.id}}",
"handlers": [],
"properties": [],
"type": "core/v1/text"
},
"displayValue": ""
}
],
"data": [
{
"key": "key 0",
"name": "Kevin Sandra0",
"link": "link-A",
"salary": 863,
"time": "2021-2-11T9:10:45.437Z"
},
{
"key": "key 1",
"name": "xzdry1",
"link": "link-B",
"salary": 276,
"time": "2021-1-11T19:10:45.437Z"
},
{
"key": "key 2",
"name": "xzdry2",
"link": "link-B",
"salary": 656,
"time": "2021-4-11T7:10:45.437Z"
},
{
"key": "key 3",
"name": "Kevin Sandra3",
"link": "link-B",
"salary": 625,
"time": "2021-10-11T1:10:45.437Z"
},
{
"key": "key 4",
"name": "xzdry4",
"link": "link-A",
"salary": 10,
"time": "2021-10-11T13:10:45.437Z"
},
{
"key": "key 5",
"name": "Kevin Sandra5",
"link": "link-B",
"salary": 913,
"time": "2021-8-11T8:10:45.437Z"
},
{
"key": "key 6",
"name": "xzdry6",
"link": "link-B",
"salary": 727,
"time": "2021-7-11T16:10:45.437Z"
},
{
"key": "key 7",
"name": "xzdry7",
"link": "link-A",
"salary": 102,
"time": "2021-1-11T1:10:45.437Z"
},
{
"key": "key 8",
"name": "xzdry8",
"link": "link-A",
"salary": 397,
"time": "2021-3-11T13:10:45.437Z"
},
{
"key": "key 9",
"name": "Kevin Sandra9",
"link": "link-A",
"salary": 850,
"time": "2021-0-11T9:10:45.437Z"
},
{
"key": "key 10",
"name": "xzdry10",
"link": "link-B",
"salary": 813,
"time": "2021-10-11T9:10:45.437Z"
},
{
"key": "key 11",
"name": "Kevin Sandra11",
"link": "link-B",
"salary": 234,
"time": "2021-2-11T21:10:45.437Z"
},
{
"key": "key 12",
"name": "xzdry12",
"link": "link-A",
"salary": 396,
"time": "2021-3-11T10:10:45.437Z"
}
],
"pagination": {
"pageSize": 6
},
"rowClick": true,
"tableLayoutFixed": false,
"borderCell": false,
"stripe": false,
"size": "default",
"pagePosition": "bottomCenter",
"rowSelectionType": "single",
"border": true,
"loading": false
},
"traits": []
},
{
"id": "api0",
"type": "core/v1/dummy",
"properties": {},
"traits": [
{
"type": "core/v1/fetch",
"properties": {
"url": "/",
"method": "post",
"lazy": false,
"headers": {
"b": "1",
"a": "2",
"c": "3"
},
"body": "{{table6.clickedRow}}",
"bodyType": "json",
"onComplete": [
{
"componentId": "",
"method": {
"name": "",
"parameters": {}
},
"disabled": false,
"wait": {
"type": "delay",
"time": 0
}
},
{
"componentId": "",
"method": {
"name": "",
"parameters": {}
},
"disabled": false,
"wait": {
"type": "delay",
"time": 0
}
}
],
"onError": []
}
}
]
}
]
}
}
Steps to reproduce
- Click the table row
What is expected?
The fetch trait would execute with the latest states.
What is actually happening?
The fetch trait doesn't execute.
Yuyz0112 commented
also run into this issue
tanbowensg commented
The best pratice of this use case is listenning onClickRow
event of table and calling triggerFetch
.
tanbowensg commented
Same solution with #356