lowcode-engine icon indicating copy to clipboard operation
lowcode-engine copied to clipboard

页面编辑器( designer ) 里面的保存Schema后点返回上一步 报错, Cannot read properties of null (reading 'componentMeta')

Open flgame opened this issue 2 years ago • 10 comments

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

页面编辑器( designer ) 里面的保存Schema后点返回上一步 报错, Cannot read properties of null (reading 'componentMeta')


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

https://lowcode-engine.cn/demo/index.html

  1. 在线上Demo里 随便拖几个组件进来
  2. 打开Schema,点击保存Schema
  3. 点击 编辑器顶部的 返回上一步
  4. 并没有按照操作意愿返回了上一步操作,而是报错了

报错信息如下

TypeError: Cannot read properties of null (reading 'componentMeta')
    at N (modal-nodes-manager.ts:7:12)
    at e (modal-nodes-manager.ts:125:19)
    at new e (modal-nodes-manager.ts:34:10)
    at document-model.ts:372:32
    at L (control.ts:21:3)
    at e (document-model.ts:365:5)
    at Yt (mobx.esm.js:1255:15)
    at e.import (mobx.esm.js:1239:12)
    at e.redoer (document-model.ts:143:14)
    at e (history.ts:99:12)

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): / 请提供如下信息(必填)

  • AliLowCodeEngine version: [e.g. 1.0.0] / 低代码引擎版本
  • AliLowCodeEngineExt version: [e.g. 1.0.0] / 低代码引擎扩展包版本
  • Browser [e.g. chrome, safari] / 浏览器版本
  • materials / plugins / tools / 其他物料 / 插件 / 工具链版本

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

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

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

flgame avatar Jul 05 '22 12:07 flgame

image

测试了下,没有报错。。。虽然 undo / redo 不符合预期,把你的具体步骤再写一下?

LeoYuan avatar Jul 06 '22 09:07 LeoYuan

第2步 保存Schema 很关键

  1. 在线上Demo里 拖入一个组件,比如标题
  2. 左下角...打开Schema,点击保存Schema
  3. 点击 编辑器顶部的 返回上一步,报错了 image

flgame avatar Jul 06 '22 11:07 flgame

复现了~

目前处理成点击回退不再报错,但是无法达到回退的效果,因为「保存 Schema」相当于重新加载了一个新的 Schema,之前的操作记录已经被复位了,是否符合预期?

LeoYuan avatar Jul 07 '22 12:07 LeoYuan

@LeoYuan 不仅仅是保存Schema会报错,保存源码、修改数据源之后都会报错或者失效,这两个应该是操作比较频繁的。 是否可以在Schema修改之后 回退到上一个Schema

flgame avatar Jul 08 '22 01:07 flgame

没看懂。。。 尝试修改数据源,没遇到什么问题

LeoYuan avatar Jul 08 '22 03:07 LeoYuan

@LeoYuan 就是把第二步换成 修改数据源或者保存源码,然后回退 会遇到相同的问题,导致redo、undo 报错及失效。

image image

flgame avatar Jul 08 '22 05:07 flgame

This issue is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 2 days.

github-actions[bot] avatar Jul 19 '22 02:07 github-actions[bot]

还是有问题,希望能解决,要不然redo、undo功能就失去了作用。

flgame avatar Jul 19 '22 05:07 flgame

通过 project.importSchema 是直接将 schema 全部重置,相当于初始化项目,丢失了操作记录。

解决方案:可以通过 project.currentDocument.importSchema,相当于往操作记录栈里推入一次操作,此时需要调用 project.simulatorHost.rerender() 刷新画布~

几个插件要作相应修改,提个 PR?

LeoYuan avatar Jul 25 '22 08:07 LeoYuan

This issue is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 2 days.

github-actions[bot] avatar Aug 05 '22 02:08 github-actions[bot]

This issue was closed because it has been stalled for 10 days with no activity.

github-actions[bot] avatar Aug 15 '22 02:08 github-actions[bot]