<Form /> has runtime errors when `noDefault` is `true`

未關閉
#532 2 則留言 1 個 reaction 已指派 1 人 在 GitHub 檢視

@ZenMasterJacob20011 已經在處理了。

開始於 2024年5月15日。

評估

這個 Issue 還沒有評估資料。

描述

Formio version @formio/[email protected]
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"
    }
  ]
}
主要語言
TypeScript
星號
371
分支
309
PR 合併指標
30 天內沒有已合併 PR

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

formio/react 的其他 Issue

查看 formio/react 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。