bug:@blocksuite_presets.js?v=63b9b401:29619 Uncaught TypeError: Illegal constructor
Closed this issue · 5 comments
这是我的最小化代码
// index.html
<title>My Project</title> <script type="module" src="/script.js"></script>// script.js
import { AffineEditorContainer } from "@blocksuite/presets";
const root = document.getElementById("root");
const editor = new AffineEditorContainer();
root.innerHTML = "";
root.appendChild(editor);
报错如下:
@blocksuite_presets.js?v=63b9b401:29619 Uncaught TypeError: Illegal constructor
at new ReactiveElement (@blocksuite_presets.js?v=63b9b401:29619:5)
at new LitElement (@blocksuite_presets.js?v=63b9b401:31082:5)
at new _ShadowlessElement (@blocksuite_presets.js?v=63b9b401:48893:26)
at new DerivedClass (@blocksuite_presets.js?v=63b9b401:7668:7)
at new SignalWatcher2 (@blocksuite_presets.js?v=63b9b401:7507:3)
at new _a16 (@blocksuite_presets.js?v=63b9b401:197887:7)
at script.js:5:16
// package.json
{
"name": "blocksuite_bug",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@blocksuite/blocks": "0.17.17",
"@blocksuite/presets": "0.17.17",
"@blocksuite/store": "0.17.17",
"vite": "^5.4.8",
"yjs": "^13.6.19"
}
}
这个问题是从"0.15.0-canary-202406291027-8aed732" 升级到latest版后出现的
包管理工具为yarn node版本v20.16.0
#8448 五天前已经有人提交过类似问题 尝试后发现新的问题
chunk-FQHTUMPG.js?v=7d56cc1f:1203 Uncaught TypeError: Cannot read properties of undefined (reading 'slots')
at _a.connectedCallback (chunk-FQHTUMPG.js?v=7d56cc1f:1203:38)
at script.js:14:6
connectedCallback @ chunk-FQHTUMPG.js?v=7d56cc1f:1203
(匿名) @ script.js:14
显示另外 1 个框架
收起
chunk-FQHTUMPG.js?v=7d56cc1f:1193 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'root')
at get rootModel (chunk-FQHTUMPG.js?v=7d56cc1f:1193:23)
at _a.render (chunk-FQHTUMPG.js?v=7d56cc1f:1218:32)
at _a.update (chunk-T2BVYFD2.js?v=7d56cc1f:12013:24)
at _a.performUpdate (chunk-T2BVYFD2.js?v=7d56cc1f:10831:14)
at b. (chunk-T2BVYFD2.js?v=7d56cc1f:7811:17)
at b.c (chunk-T2BVYFD2.js?v=7d56cc1f:7750:19)
at E (chunk-T2BVYFD2.js?v=7d56cc1f:7781:8)
at _a.performUpdate (chunk-T2BVYFD2.js?v=7d56cc1f:7808:24)
at _a.scheduleUpdate (chunk-T2BVYFD2.js?v=7d56cc1f:10775:25)
at _a.__enqueueUpdate (chunk-T2BVYFD2.js?v=7d56cc1f:10751:25)
#8448 五天前已经有人提交过类似问题 尝试后发现新的问题
chunk-FQHTUMPG.js?v=7d56cc1f:1203 Uncaught TypeError: Cannot read properties of undefined (reading 'slots')
at _a.connectedCallback (chunk-FQHTUMPG.js?v=7d56cc1f:1203:38) at script.js:14:6
connectedCallback @ chunk-FQHTUMPG.js?v=7d56cc1f:1203
(匿名) @ script.js:14
显示另外 1 个框架
收起
chunk-FQHTUMPG.js?v=7d56cc1f:1193 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'root')
at get rootModel (chunk-FQHTUMPG.js?v=7d56cc1f:1193:23) at _a.render (chunk-FQHTUMPG.js?v=7d56cc1f:1218:32) at _a.update (chunk-T2BVYFD2.js?v=7d56cc1f:12013:24) at _a.performUpdate (chunk-T2BVYFD2.js?v=7d56cc1f:10831:14) at b.<anonymous> (chunk-T2BVYFD2.js?v=7d56cc1f:7811:17) at b.c (chunk-T2BVYFD2.js?v=7d56cc1f:7750:19) at E (chunk-T2BVYFD2.js?v=7d56cc1f:7781:8) at _a.performUpdate (chunk-T2BVYFD2.js?v=7d56cc1f:7808:24) at _a.scheduleUpdate (chunk-T2BVYFD2.js?v=7d56cc1f:10775:25) at _a.__enqueueUpdate (chunk-T2BVYFD2.js?v=7d56cc1f:10751:25)
请问出现该错误的复现代码是怎样的呢?
import {
AffineEditorContainer,
PageEditor,
createEmptyDoc,
} from "@blocksuite/presets";
import { effects as blocksEffects } from "@blocksuite/blocks/effects";
import { effects as presetsEffects } from "@blocksuite/presets/effects";
blocksEffects();
presetsEffects();
import { Text } from "@blocksuite/store";
const editor = new AffineEditorContainer();
// const doc = createEmptyDoc().init();
// editor.doc = doc;
document.body.appendChild(editor);
我又按照官网的教程尝试了一遍,发现在不为editor添加doc的时候,才会出现这个报错,所以已经解决了,这其实不算一个bug
#8393 (comment) this resolved the issue