Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better integrate with React Hooks #3056

Closed
ianstormtaylor opened this issue Oct 9, 2019 · 6 comments
Closed

better integrate with React Hooks #3056

ianstormtaylor opened this issue Oct 9, 2019 · 6 comments

Comments

@ianstormtaylor
Copy link
Owner

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

Improvement.

What's the current behavior?

The slate-react library was written before hooks, and while we were still tied to Immutable.js. It would be nice if it was written to accommodate React Hooks better. I haven't figured out exactly how this would work while still solving for the constraints we have with plugins...

But if people have ideas I'd love to hear them!

@ianstormtaylor
Copy link
Owner Author

@steida in your editor can plugins override other plugins's event listeners?

I'm down with changing the architecture to accommodate hooks if it makes the architecture better for sure. Can you example more about how the reducing architecture works? and the client vs. server versions?

@ianstormtaylor
Copy link
Owner Author

Can you explain the Immer anti-composability argument? Curious about that.

Do plugins in your editor have the ability to override functions from other plugins, but then call back into the they want? For example like someone overriding the splitBlock command to handle the special case of splitting in lists or tables.

@ryanmitts
Copy link
Contributor

ryanmitts commented Oct 24, 2019

I think I read that plugins will be moving to a different approach like composition, is this hook rewrite intended to happen before or after that change? I have some ideas around hooks, but depending on how the plugin structure will be I don't know if it's worth looking into now.

@ianstormtaylor
Copy link
Owner Author

@ryanmitts great question! I don’t have anything planned for hooks so far, so after.

The one thing I’m wary of with hooks is that it seems like potentially the most “hook-native” API would need to be entirely implemented in hooks? Not something we want to do since non-React use cases are important.

At this point I’m mostly interested in hearing other people’s thoughts on what the best hook-based API would be. So I’d love to hear what you’re thinking!

@ryanmitts
Copy link
Contributor

Could you have a 'special' plugin for the editor that allows setting and changing the implementations of the various callbacks/handlers passed into the editor? You can use hooks to only re-set the handlers when they change.

@ianstormtaylor ianstormtaylor mentioned this issue Nov 6, 2019
@ianstormtaylor
Copy link
Owner Author

Fixed by #3093.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants