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

Reduce frequency of actions updating isCaretWithinFormattedText #11235

Merged
merged 1 commit into from
Oct 30, 2018

Conversation

talldan
Copy link
Contributor

@talldan talldan commented Oct 30, 2018

Description

Reduces the issue mentioned in #10983 (comment) by only triggering a state change when needed.

How has this been tested?

  • Tested frequency of state updates using redux dev tools
  • Tested that feature continues to work

Screenshots

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

…nly triggering them when they cause a change in state
@talldan talldan added [Type] Task Issues or PRs that have been broken down into an individual action to take [Type] Code Quality Issues or PRs that relate to code quality labels Oct 30, 2018
@talldan talldan self-assigned this Oct 30, 2018
if ( start !== this.state.start || end !== this.state.end ) {
const isCaretWithinFormattedText = this.props.isCaretWithinFormattedText;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not destruct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there's only one property I don't really have a preference either way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree when it doesn't get assigned, but in this case it duplicates isCaretWithinFormattedText, so it does make it a bit less verbose.

@youknowriad youknowriad added this to the 4.2 milestone Oct 30, 2018
@youknowriad youknowriad merged commit afe5b45 into master Oct 30, 2018
@youknowriad youknowriad deleted the fix/reduce-exit-formatted-text-dispatches branch October 30, 2018 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants