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

Rich Text: Unnecessarily dispatching change actions #5103

Closed
aduth opened this issue Feb 16, 2018 · 0 comments · Fixed by #6455
Closed

Rich Text: Unnecessarily dispatching change actions #5103

aduth opened this issue Feb 16, 2018 · 0 comments · Fixed by #6455
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Bug An existing feature does not function as intended

Comments

@aduth
Copy link
Member

aduth commented Feb 16, 2018

Issue Overview

The RichText component dispatches more change actions than necessary.

Steps to Reproduce

  1. Create a post with a single paragraph and save it
  2. Refresh the page and open Redux DevTools
  3. Select the first paragraph and type a single letter
  4. Deselect the block by clicking the title

Expected Behavior

A single change action is dispatched.

Current Behavior

Three change actions are dispatched:

  • Two at the keypress
  • One at the deselect

This wouldn't be entirely problematic if the value weren't a new array each time, as the reducer considers it a new value and updates references accordingly (thus triggering rerenders).

Possible Solution

Should we be checking that content has changed from RichText before triggering an update?

Related

Possibly related to #4956

cc @iseulde @youknowriad

@aduth aduth added [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Bug An existing feature does not function as intended labels Feb 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant