react-page / react-page

Next-gen, highly customizable content editor for the browser - based on React and written in TypeScript. WYSIWYG on steroids.

Home Page:https://react-page.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

beta: undo of slate content no longer works

macrozone opened this issue Β· comments

Describe the bug

undo no longer works properly for slate on the beta version, where we updated to the newest slate/slate-react

reason is that slate change the meaning of value, its no longer to set the value (as conventions dictate). Instead it only sets the initialValue, which makes slate harder to control. (see also ianstormtaylor/slate#4992)

At this point its unclear to how to fix it, slate integration was always a bit tricky and our integration is also a bit hacky with the debouncing. I have to figure out how to do this more cleanly

πŸŽ‰ This issue has been resolved in version 4.10.0-beta.4 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

πŸŽ‰ This issue has been resolved in version 4.11.0-beta.1 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

πŸŽ‰ This issue has been resolved in version 4.11.0 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

Looking at the commit where this was fixed, ed7d2b8#diff-b3b7bde30c2e6e9f379e434183f8f71935c64d61d22d236d092e3c7726131b84R57 - should useCallback also have a data dependency on data?.selection? If any external system were to change the data.selection, I think the old value of the data.selection might be bound to the memoized version of the callback, which might cause glitches down the road?

Looking at the commit where this was fixed, ed7d2b8#diff-b3b7bde30c2e6e9f379e434183f8f71935c64d61d22d236d092e3c7726131b84R57 - should useCallback also have a data dependency on data?.selection? If any external system were to change the data.selection, I think the old value of the data.selection might be bound to the memoized version of the callback, which might cause glitches down the road?

could be, but i am not sure. Tbh. its a still a bit "magic" and not 100% clean. There were some glitches with slate and that solution worked properly.

it indeed still works with external updates, in fact undo/redo are external and will also update the selection as long as the content changed as well (selection updates should not add to the undo stack anyway)