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.

slate-react 0.66.x - weird bug with next/link and passHref

See original GitHub issue

Description

we use slate and slate-react in https://github.com/react-page/react-page as the rich-content editor.

I observed a problem when updating to react-slate 0.66.x. When i add a character at the end of certain inline or mark-elements that render a next/link with passHref property, slate adds the character twice (once inside and once outside of the component) and sometimes crashes with a Failed to execute 'setStart' on 'Range': There is no child at offset xx.

The bug does not happen if I don’t set passHref, so i assume that passHref does some Element cloning (in order to inject href as property) and that this messes with slate.

the bug only happens when i insert a char at the end.

Recording

https://user-images.githubusercontent.com/1972353/137481690-ea3500a4-eda6-4064-a7ae-4292c4aec6e6.mov

Sandbox

not yet available

Steps

not yet available

Expectation A clear and concise description of what you expected to happen. (Often it’s helpful to test out the behavior of other editors like Google Docs, Medium, Notion, etc. to see how they handle the same issue.)

Environment

  • Slate Version: 0.66.5
  • Slate React Version: 0.66.0 - 0.66.7
  • Operating System: macOS
  • Browser: Chrome

I tried downgrading only slate-react to 0.65.x and the error disappears even with newest slate (core) version

Context

This is probably a bit tricky to reproduce and i try to add more context if i have some.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dylanscommented, Oct 27, 2021

This should be fixed with the latest releases. Please reopen if it is not. (latest slate-react is 0.69.0).

0reactions
macrozonecommented, May 13, 2022

seems to be fixed in latest version, at least could not reproduce it so far.

Read more comments on GitHub >

github_iconTop Results From Across the Web

slate-react 0.66.x - weird bug with next/link and passHref
x. When i add a character at the end of certain inline or mark-elements that render a next/link with passHref property, slate adds...
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