_bug_
When I start with an empty state, add some text and make NO changes to it, f. If I then programmatically reset the state via a button it results in a crash.
Slate: 0.XX.X
Browser: Chrome / Safari / Firefox / Edge
OS: Mac / Windows / Linux / iOS / Android
Hey @ramsy-leftclick, this happens if you don't also reset the selection state which is stored separately from the value. Also, your empty state must have at least one text node in it.
In the future, some code to show a minimum reproduction of the error would be helpful as well :)
Hi @CameronAckermanSEL.
Thanks for the response. I made a Sandbox containing the code, which I've submitted with the bug.
Hi @ramsy-leftclick , this is not a bug. You need to reset selection when you reset the editor value, because selection is not packed in with the value. The crash is because when you rip out the value under the editor, it will still hold onto its current selection state and then have nothing to retrieve at that area.
You probably need to call something like Transforms.select(editor, [0]) before setValue
Hi @ramsy-leftclick , this is not a bug. You need to reset selection when you reset the editor value, because selection is not packed in with the value. The crash is because when you rip out the value under the editor, it will still hold onto its current selection state and then have nothing to retrieve at that area.
You probably need to call something like
Transforms.select(editor, [0])beforesetValue
select din't work for me, I had to use: Transforms.deselect(editor);
Most helpful comment
Hi @ramsy-leftclick , this is not a bug. You need to reset selection when you reset the editor value, because selection is not packed in with the value. The crash is because when you rip out the value under the editor, it will still hold onto its current selection state and then have nothing to retrieve at that area.
You probably need to call something like
Transforms.select(editor, [0])beforesetValue