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

Eliminate obsolete call to onChange when RichText componentWillUnmount #6150

merged 1 commit into from Apr 13, 2018


None yet
4 participants

westonruter commented Apr 12, 2018

Fixes #6134.

When wp.hooks.addFilter( 'blocks.BlockEdit'… ) is used to extend blocks which contain the RichEdit component, this will cause the component to be unmounted and with that onChange will be called:

componentWillUnmount() {

This results in the editor being put into a dirty state upon initialization, even if no changes have been made by the user. This bit of code actually appears to be a remnant of the past, @iseulde in #6134 (comment):

Everything should be synced whenever there is a change in the editor. At first sight I think it is fine to remove. It seems to be a remnant from when we only synced the value on blur.

But @youknowriad adds:

I agree with this statement, but I'd test carefully the different usecases, of splitting/merging/switching etc... :) fast typing + splitting

I'm not sure how best to go about testing this change, but I wanted to open a PR at least to get the fix off the ground.

@westonruter westonruter requested a review from iseulde Apr 12, 2018

@gziolo gziolo added this to the 2.7 milestone Apr 13, 2018


This comment has been minimized.


gziolo commented Apr 13, 2018

I like this change. Hopefully, it doesn't introduce any regressions :)


LGTM 👍 No regression found. If we encounter one, it will be an excuse to add an E2E test :)

@gziolo gziolo merged commit 4c0521e into master Apr 13, 2018

2 checks passed

codecov/project 44.44% (+<.01%) compared to 0a084ad
continuous-integration/travis-ci/pr The Travis CI build passed

@gziolo gziolo deleted the fix/unmount-onchange branch Apr 13, 2018

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