question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot get the start point in the node at path [1] because it has no start text node.

See original GitHub issue

Do you want to request a feature or report a bug?

Report a bug

What’s the current behavior?

Bug GIF:

https://codesandbox.io/s/slate-reproductions-cm3r7?file=/index.js

Slate: 0.57.1 Browser: Chrome OS: Mac

What’s the expected behavior?

The expected behavior is that the string can be parsed to Slate object without throwing an error.


I found that the bug is in this function

https://github.com/ianstormtaylor/slate/blob/f6bfe034d707693488c38da77537fd36cb8856cf/packages/slate-hyperscript/src/creators.ts#L27-L81

because the p tag has no text, the children parameter is an empty array, therefore the for loop is never performed and returns the variable node as an empty array.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
camerackercommented, Apr 22, 2020

Hi @lavaldi , the issue is that the paragraph blocks the deserialize function generates are allowed to have no children. This is an invalid state for slate; all blocks need to have at least one text node, even if it is empty. The deserializer function should be updated to correct that issue.

As for images, you should be able to pass a void flag to the image block to indicate that it is not intended to have text children. See the image example for how some examples of void blocks.

0reactions
TheSpydercommented, Apr 16, 2021

Perhaps a validation should be added that if children is an empty array that it returns [{ text: '' }] 🤔

If #4208 is merged, this will happen when Editor.normalize is used (for example Editor.normalize(editor, { force: true }) can be used to normalize an entire document).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Slate.js throws an error when inserting a new node at selected ...
The issue is related to rendering when you use useMemo , instead you should use useRef : const editorRef = useRef() if (!editorRef.current) ......
Read more >
Fix "Problem updating node" errors in Zaps - Zapier Help
Fix "Problem updating node" errors in Zaps · 1. Try another browser · 2. Try another device · 3. Check your corporate network...
Read more >
Error: Cannot resolve a DOM point from Slate point
Now fully understanding the issue, I set out to figure out how to move the cursor to the beginning of the input before...
Read more >
Normalizing - Slate
This can happen if you check for a specific invalid structure, but then don't actually fix that structure with the change you make...
Read more >
Nodes and Edges - PGF/TikZ Manual
Rather, they are added to the picture just before or after the path has been ... Thus, you can name a node just...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found