formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

[BUG] Select component on select not propagated

Open MiguiTE opened this issue 2 years ago • 1 comments

I found a bug with the select component when doing infinite scrolling of URL requests. Firstly, when the user scrolls, a new request is made (expect to be made when scrolling to bottom). Secondly, if the request is pending, the selection isn't propagated. Therefore, if there is other components with calculated values that depends on the select one, the values aren't computed.

This only occurs when the selection is made while the pagination request is pending.

Environment

Please provide as many details as you can:

Steps to Reproduce

  1. Go to Formio Builder
  2. Build the form like the one given below
  3. Select and Honda Model
  4. Open the Select component DropDown again
  5. Scroll down
  6. Select other Honda Model

You may need to throttle your request, so that each of the pagination request last enough.

Expected behavior

  • The new Honda Model is selected.
  • The components "ID" and "Name" will be recalculated

Observed behavior

  • The new Honda Model is selected but a couple of seconds later it is reseted to the first selection
  • The components aren't recalculated

Example

Vídeo reproducing the bug

For code or form JSON, please enclose in a code block:

{
            "display": "form",
            "settings": {
                "pdf": {
                    "id": "1ec0f8ee-6685-5d98-a847-26f67b67d6f0",
                    "src": "https://files.form.io/pdf/5692b91fd1028f01000407e3/file/1ec0f8ee-6685-5d98-a847-26f67b67d6f0"
                }
            },
            "components": [
                {
                    "label": "Honda",
                    "widget": "choicesjs",
                    "tableView": true,
                    "dataSrc": "url",
                    "data": {
                        "url": "https://vpic.nhtsa.dot.gov/api/vehicles/getmodelsformake/honda?format=json",
                        "headers": [
                            {
                                "key": "",
                                "value": ""
                            }
                        ]
                    },
                    "idPath": "Make_ID",
                    "template": "<span>{{ item.Model_Name }}</span>",
                    "key": "select",
                    "type": "select",
                    "selectValues": "Results",
                    "disableLimit": false,
                    "limit": 90,
                    "ignoreCache": true,
                    "input": true
                },
                {
                    "label": "ID",
                    "tableView": true,
                    "calculateValue": "value = data.select.Model_ID",
                    "key": "textField",
                    "type": "textfield",
                    "input": true
                },
                {
                    "label": "Name",
                    "tableView": true,
                    "calculateValue": "value = data.select.Model_Name",
                    "key": "textField1",
                    "type": "textfield",
                    "input": true
                },
                {
                    "type": "button",
                    "label": "Submit",
                    "key": "submit",
                    "disableOnInvalid": true,
                    "input": true,
                    "tableView": false
                }
            ],
            "input": true,
            "key": "",
            "tableView": false,
            "label": ""
        }

MiguiTE avatar Jun 22 '22 07:06 MiguiTE

happens to me

Agustin95 avatar Jun 22 '22 08:06 Agustin95

Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!

daneformio avatar Feb 07 '24 14:02 daneformio