You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The debugging info:
TreeView.svelte:184 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')
at generateContent (TreeView.svelte:184:20)
at $$self.$$.update (TreeView.svelte:68:15)
at init (Component.js:144:5)
at new TreeView (TreeView.svelte:97:26)
at create_fragment91 (TreeView.svelte:97:26)
at init (Component.js:148:34)
at new TreeViewPlugin (TreeView.svelte:97:26)
at create_if_block (RichTextComposer.svelte:163:54)
at Object.update [as p] (RichTextComposer.svelte:172:32)
at update_slot_base (utils.js:203:8)
demo from playground.
Code from 20240925
Reproduction:
1 run the playground demo
2 goto setting button
3 turn on debug view bar
4 turn off debug view bar
then the error found in the console.
How to resolve:
function generateContent(
editor: LexicalEditor,
commandsLog: ReadonlyArray<
{index: number} & LexicalCommand & {payload: unknown}
The debugging info:$$self.$$ .update (TreeView.svelte:68:15)
TreeView.svelte:184 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')
at generateContent (TreeView.svelte:184:20)
at
at init (Component.js:144:5)
at new TreeView (TreeView.svelte:97:26)
at create_fragment91 (TreeView.svelte:97:26)
at init (Component.js:148:34)
at new TreeViewPlugin (TreeView.svelte:97:26)
at create_if_block (RichTextComposer.svelte:163:54)
at Object.update [as p] (RichTextComposer.svelte:172:32)
at update_slot_base (utils.js:203:8)
demo from playground.
Code from 20240925
Reproduction:
1 run the playground demo
2 goto setting button
3 turn on debug view bar
4 turn off debug view bar
then the error found in the console.
How to resolve:
function generateContent(
editor: LexicalEditor,
commandsLog: ReadonlyArray<
{index: number} & LexicalCommand & {payload: unknown}
// 在调用 generateContent 之前进行检查
if (editor && commandsLog !== undefined) { <<---------should add undefined checking ?
if (Array.isArray(commandsLog) && commandsLog.length > 0) {
const content = generateContent(editor, commandsLog, exportDOM);
// 使用生成的内容
} else {
console.error('commandsLog is not an array or is empty.');
}
} else {
console.error('editor or commandsLog is undefined.');
}
The text was updated successfully, but these errors were encountered: