Skip to content

fileUploadingEnd events argument should be promise or fullfilled object #6175

@petrbizon

Description

@petrbizon

Duplicate of #Describe the bug
File component after upload should emit fileUploadingEnd event with promise or fullfilled object:
https://help.form.io/developers/form-development/form-renderer#form-events

Image
but it returns empty object arguments[19][0] in the time of event. You must set the timeout to access this object.
arguments[20][0] is not used.

Version/Branch
5.3.0-rc.2

To Reproduce
Steps to reproduce the behavior:

  1. Create form...
  2. Add file component
  3. set the logic with event fileUploadingEnd as trigger and custom action: console.log(arguments[20][0]);
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
		<meta name="viewport" content="width=device-width, initial-scale=1"/>
		<link rel="stylesheet" href="bootstrap.min.css"/>
		<script src="formio.full.5.3.0-rc.2.js"></script><!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="stylesheet" href="bootstrap.min.css"/>
    <script src="formio.full.5.3.0-rc.2.js"></script>
  </head>
  <body>
    <div id="formio"/>
    <script>
      const formular = {
        "components": [
          {
            "capture": false,
            "fileTypes": [
              {
                "label": "",
                "value": ""
              }
            ],
            "input": true,
            "key": "file",
            "label": "Upload",
            "logic": [
              {
                "actions": [
                  {
                    "customAction": "console.log(arguments[20][0]);",
                    "name": "fileUploadingEnd",
                    "type": "customAction"
                  }
                ],
                "name": "fileUploadingEnd",
                "trigger": {
                  "event": "fileUploadingEnd",
                  "type": "event"
                }
              }
            ],
            "storage": "base64",
            "tableView": false,
            "type": "file",
            "validateWhenHidden": false,
            "webcam": false
          }
        ]
      };
      Formio.createForm(document.getElementById('formio'), formular);
    </script>
  </body>
</html>

If I add on the row 1086 ( https://github.com/formio/formio.js/blob/v5.3.0-rc.2/src/components/file/File.js#L1086 ) this:
this.emit('fileUploadingEnd', fileInfo);
in the oposite of this:
this.emit('fileUploadingEnd');
It is ok.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions