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

useRemirror:onChange callback isn't called in StrictMode #371

Closed
1 task done
ronnyroeller opened this issue Jul 23, 2020 · 1 comment · Fixed by #373
Closed
1 task done

useRemirror:onChange callback isn't called in StrictMode #371

ronnyroeller opened this issue Jul 23, 2020 · 1 comment · Fixed by #373

Comments

@ronnyroeller
Copy link
Collaborator

ronnyroeller commented Jul 23, 2020

Description

I'm setting up a remirror editor with the onChange callback to capture the active state of the commands as explained in the Usage example:

const { commands, active } = useRemirror(() => {
  setActiveCommands({
    bold: active.bold(),
    italic: active.italic(),
    underline: active.underline()
  });
});

The onChange callback is correctly called if the editor element isn't placed within <React.StrictMode>. Yet, running it in StrictMode stops the callback from being called.

Reproduction case in CodeSandbox:
https://codesandbox.io/s/determined-breeze-ewjky?fontsize=14&hidenavigation=1&theme=dark

Possible workaround

Remove React.StrictMode

Checklist

@ronnyroeller ronnyroeller changed the title onChange callback isn't called in StrictMode useRemirror:onChange callback isn't called in StrictMode Jul 23, 2020
@ifiokjr ifiokjr mentioned this issue Jul 23, 2020
4 tasks
@ifiokjr
Copy link
Member

ifiokjr commented Jul 26, 2020

Forgot to say, thanks for opening this issue. I appreciate the effort that goes into it and it makes the codebase so much better.

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 a pull request may close this issue.

2 participants