Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Form /> has runtime errors when noDefault is true #532

Open
namti opened this issue Aug 28, 2023 · 2 comments
Open

<Form /> has runtime errors when noDefault is true #532

namti opened this issue Aug 28, 2023 · 2 comments
Assignees

Comments

@namti
Copy link

namti commented Aug 28, 2023

Formio version @formio/react@5.3.0-rc.2
React version: 18.2.0

If noDefault in options is true, an error occurs after choose a file for a file component.

File.js:764 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'some')
    at _callee$ (File.js:764:1)
    at tryCatch (File.js:99:1)
    at Generator.<anonymous> (File.js:99:1)
    at Generator.next (File.js:99:1)
    at asyncGeneratorStep (File.js:100:1)
    at _next (File.js:101:1)
    at File.js:101:1
    at new Promise (<anonymous>)
    at File.js:101:1
    at File.js:926:1

_callee$ | @ | File.js:764
-- | -- | --
  | tryCatch | @ | File.js:99
  | (anonymous) | @ | File.js:99
  | (anonymous) | @ | File.js:99
  | asyncGeneratorStep | @ | File.js:100
  | _next | @ | File.js:101
  | (anonymous) | @ | File.js:101
  | (anonymous) | @ | File.js:101
  | (anonymous) | @ | File.js:926
  | upload | @ | File.js:717
  | (anonymous) | @ | File.js:465
  | Promise.then (async) |   |  
  | (anonymous) | @ | File.js:464
<Form
  form={form_json}
  onChange={onFormChange}
  submission={submission_json}
  options={{ 
    noDefaults: true
  }}
/>

form_json

{
  "components": [
    {
      "label": "Upload",
      "labelPosition": "top",
      "description": "",
      "tooltip": "",
      "customClass": "",
      "tabindex": "",
      "hidden": false,
      "hideLabel": false,
      "autofocus": false,
      "disabled": false,
      "tableView": false,
      "modalEdit": false,
      "storage": "base64",
      "dir": "",
      "fileNameTemplate": "",
      "image": false,
      "uploadOnly": false,
      "webcam": false,
      "fileTypes": [
        {
          "label": "",
          "value": ""
        }
      ],
      "filePattern": "*.heic,*.gif,*.jpg,*.jpeg,*.png,*.bmp,*.pdf,*.zip,*.ppt,*.pptx,*.doc,*.docx,*.xls,*.xlsx",
      "fileMinSize": "0KB",
      "fileMaxSize": "10MB",
      "multiple": false,
      "persistent": true,
      "protected": false,
      "dbIndex": false,
      "encrypted": false,
      "redrawOn": "",
      "clearOnHide": true,
      "customDefaultValue": "",
      "calculateValue": "",
      "calculateServer": false,
      "allowCalculateOverride": false,
      "validate": {
        "required": false,
        "customMessage": "",
        "custom": "",
        "customPrivate": false,
        "json": "",
        "strictDateValidation": false,
        "multiple": false,
        "unique": false
      },
      "errorLabel": "",
      "errors": "",
      "key": "file",
      "tags": [],
      "properties": [],
      "conditional": {
        "show": null,
        "when": null,
        "eq": "",
        "json": ""
      },
      "customConditional": "",
      "logic": [],
      "attributes": [],
      "overlay": {
        "style": "",
        "page": "",
        "left": "",
        "top": "",
        "width": "",
        "height": ""
      },
      "type": "file",
      "imageSize": "200",
      "input": true,
      "placeholder": "",
      "prefix": "",
      "suffix": "",
      "defaultValue": null,
      "unique": false,
      "refreshOn": "",
      "dataGridLabel": false,
      "widget": null,
      "validateOn": "change",
      "showCharCount": false,
      "showWordCount": false,
      "allowMultipleMasks": false,
      "addons": [],
      "privateDownload": false,
      "id": "ecedeus"
    }
  ]
}
@TanyaGashtold
Copy link
Contributor

Yes, we are able to replicate it, this is a formio.js library bug. Our QA team will create a ticket for the issue and include it in our internal Form.io developer queue. If you think, it is something that you can fix by yourself or need the fix faster, your PRs are highly appreciated in https://github.com/formio/formio.js.

@ZenMasterJacob20011
Copy link

A Ticket has been created for this issue. FIO-8420

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants