alibaba / lowcode-engine

An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系
https://lowcode-engine.cn
MIT License
14.58k stars 2.53k forks source link

数据源面板新建提示Cannot read properties of null (reading 'createVoidField') #1084

Closed zoomwang closed 1 year ago

zoomwang commented 2 years ago

Describe the bug (required) / 详细描述 bug(必填)

A clear and concise description of what the bug is. / 请提供清晰且精确的 bug 描述


To Reproduce (required) / 如何复现 bug?(必填,非常重要)

1.打开数据源面板 2.点击新建,提示:Cannot read properties of null (reading 'createVoidField')


English version example:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

中文版示例:

  1. 打开 demo
  2. 点击标题;
  3. 在右侧修改标题内容为「修改后的标题」;
  4. 渲染画布标题组件没有更新显示为「修改后的标题」;

Expected behavior (required) / 预期行为(必填,非常重要)

A clear and concise description of what did you expect to happen. / 请清晰和精确的描述你预期的行为


Screenshots (optional) / bug 截图(可选)

Sceenshots for further information. (If applicable.) / 一些有用的截图将会帮助我们更好的明确以及定位问题


Environments (please complete the following information) (required): / 请提供如下信息(必填)

(this information can be collected via the manual plugin / 版本信息可通过低代码用户手册插件收集)

Additional context (optional) / 更多额外信息(可选)

Any other context of the problem here. / 可以追加更多的额外信息,帮助定位问题

liujuping commented 2 years ago

1.@alilc/lowcode-plugin-datasource-pane 是什么版本,可以尝试升级到最新

2.复现路径是什么样子的,demo 是否可以复现。

github-actions[bot] commented 2 years ago

你好 @zoomwang,由于缺乏必要的信息(如 bug 重现步骤、引擎版本信息 等),无法定位问题,请按照 issue bug 模板 补全信息,也可以通过阅读引擎的 issue 说明 了解什么类型的 issue 可以获得更好、更快的支持。

zoomwang commented 2 years ago

@alilc/lowcode-plugin-datasource-pane版本是1.0.6

liujuping commented 2 years ago

@twinkle77 辛苦帮忙看看这个问题。

zoomwang commented 2 years ago

image

iPortNe commented 2 years ago

遇到相同问题,新建和编辑数据源都会出现这个问题。 使用的是lowcode-demo 1.0.27的默认依赖

twinkle77 commented 2 years ago

遇到相同问题,新建和编辑数据源都会出现这个问题。 使用的是lowcode-demo 1.0.27的默认依赖

我看下

twinkle77 commented 2 years ago

@iPortNe @zoomwang
重新 clone 了最新 lowcode-demo ,本地没有复现这个问题,lowcode-demo 在线也无法复现

从图片看是 formily 的报错

想确认下,你们项目是不是也依赖 formily,尝试更新下 formily 的版本 ?

cc @liujuping

eeve commented 1 year ago

image

image

相同的问题

依赖版本如下:

{
  "dependencies": {
    "@alilc/lowcode-datasource-fetch-handler": "^1.1.3",
    "@alilc/lowcode-plugin-code-editor": "^1.0.5",
    "@alilc/lowcode-plugin-code-generator": "^1.0.5",
    "@alilc/lowcode-plugin-components-pane": "^1.0.3",
    "@alilc/lowcode-plugin-datasource-pane": "^1.0.7",
    "@alilc/lowcode-plugin-inject": "^1.1.3",
    "@alilc/lowcode-plugin-manual": "^1.0.3",
    "@alilc/lowcode-plugin-schema": "^1.0.2",
    "@alilc/lowcode-plugin-simulator-select": "^1.0.2",
    "@alilc/lowcode-plugin-undo-redo": "^1.0.0",
    "@alilc/lowcode-plugin-zh-en": "^1.0.0",
    "@alilc/lowcode-react-renderer": "^1.0.16",
    "@alilc/lowcode-setter-behavior": "^1.0.0",
    "@alilc/lowcode-setter-title": "^1.0.2",
    "@alilc/lowcode-utils": "^1.0.16",
    "@formily/antd": "^2.2.13",
    "@formily/core": "^2.2.13",
    "@formily/react": "^2.2.13",
    "@seada/antd-plugins": "0.0.1-rc.8",
    "file-saver": "^2.0.5",
    "html2canvas": "^1.4.1",
    "jszip": "^3.10.1",
    "antd": "^4.23.2",
    "axios": "^0.27.2",
    "moment": "^2.29.4",
    "uuid": "^8.3.2",
    "lodash-es": "^4.17.21"
  },
  "devDependencies": {
    "@alib/build-scripts": "^0.1.32",
    "@alilc/lowcode-engine": "^1.0.16",
    "@alilc/lowcode-engine-ext": "^1.0.5",
    "@alilc/lowcode-types": "^1.0.16",
    "@types/events": "^3.0.0",
    "@types/react": "^18.0.25",
    "@types/react-dom": "^18.0.9",
    "@types/streamsaver": "^2.0.1",
    "@types/uuid": "^8.3.4",
    "@types/file-saver": "^2.0.5",
    "@types/lodash-es": "^4.17.6",
    "build-plugin-fusion": "^0.1.23",
    "build-plugin-moment-locales": "^0.1.3",
    "build-plugin-react-app": "^1.1.2",
    "dotenv": "^16.0.3",
    "fs-extra": "^10.1.0",
    "regenerator-runtime": "^0.13.11",
    "tsconfig-paths-webpack-plugin": "^3.5.2"
  }
}
eeve commented 1 year ago

原因找到了,我使用的pnpm,通过搜索lock文件,发现@formily/相关的包存在多个不同版本(2.2.152.1.12),猜测是这个引起的,故手动锁定到了最新版: 2.2.15,如下图,问题随即解决。

package.json

{
  ...
  "resolutions": {
    "@formily/antd": "2.2.15",
    "@formily/core": "2.2.15",
    "@formily/react": "2.2.15",
    "@formily/next": "2.2.15"
  }
}

image

这个包的版本声明与实际的版本不一致,导致pnpm使用了两个不同的版本 https://github.com/alibaba/lowcode-plugins/blob/main/packages/plugin-datasource-pane/package.json#L62

Shijf commented 1 year ago

同样遇到这个问题,懵懵懵

liujuping commented 1 year ago

解决方案:

1.lowcode-demo 中除了 formily 场景,其他场景不应该依赖 @formily/xxx

2.formily 场景需要通过 "resolutions" 来固定 @formily/xxx 的版本,防止不同的插件之间 @formily/xxx 版本不一致。