Skip to content

Displaying 2 Slate components with the same initialValue breaks the page #6016

@grose-dg

Description

@grose-dg

Description
Using slate 0.123.0, when rendering 2 components with the same value reference, we get an error in the findPath function :
Unable to find the path for Slate node: {"text":"This is editable "}
at Object.findPath (http://localhost:3000/static/js/bundle.js:23324:11)
at Object.toSlatePoint (http://localhost:3000/static/js/bundle.js:23689:26)
at Object.toSlateRange (http://localhost:3000/static/js/bundle.js:23795:28)
at setDomSelection (http://localhost:3000/static/js/bundle.js:27951:38)
at http://localhost:3000/static/js/bundle.js:28003:7
at Object.react_stack_bottom_frame (http://localhost:3000/static/js/bundle.js:18667:18)
at runWithFiberInDEV (http://localhost:3000/static/js/bundle.js:5954:68)
at commitHookEffectListMount (http://localhost:3000/static/js/bundle.js:11958:157)
at commitHookLayoutEffects (http://localhost:3000/static/js/bundle.js:11945:56)
at commitLayoutEffectOnFiber (http://localhost:3000/static/js/bundle.js:12314:22)

This was not the case with previous versions.

Recording
Image

Steps
See the gif above :
Have 2 components rendered with the same initialValue reference (if we stringify both values we bypass the issue).

Expectation
We can display the same value multiple times on the same page as we did before slate-dom 0.123.0 (0.119 and prior).

Environment

  • Slate Version: 0.123.0
  • Operating System: Windows
  • Browser: Chrome / Firefox

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions