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

Fix - Increment number in Slate keygenerator function #109

Merged
merged 2 commits into from
Oct 23, 2019

Conversation

v-stickykeys
Copy link
Contributor

Problem

The keyInt wasn't being incremented and produced this error:

A node with a duplicate key of "1571842451212_0" was found! Duplicate keys are not allowed, you should use `node.regenerateKey` before inserting if you are reusing an existing node.

Solution

Define keyInt inside of the render method because the keygen function does not have access to the local state updates from MyApp.

Notes

See example here: https://github.com/zeit/next.js/blob/canary/examples/with-slate/lib/useCustomKeygen.js

@v-stickykeys v-stickykeys requested a review from CraigLu October 23, 2019 15:14
@v-stickykeys
Copy link
Contributor Author

@CraigLu Want to make sure this still meets what you need for the diffing.

@v-stickykeys v-stickykeys merged commit 783fed0 into development Oct 23, 2019
@v-stickykeys v-stickykeys deleted the bugfix-keygen branch October 23, 2019 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant