Skip to content

Fix ReactShallowRenderer not rerendering when calling forceUpdate() - #11439

Merged
gaearon merged 2 commits into
react:masterfrom
d4rky-pl:issue-11236-2
Nov 3, 2017
Merged

Fix ReactShallowRenderer not rerendering when calling forceUpdate()#11439
gaearon merged 2 commits into
react:masterfrom
d4rky-pl:issue-11236-2

Conversation

@d4rky-pl

@d4rky-pl d4rky-pl commented Nov 3, 2017

Copy link
Copy Markdown
Contributor

This is a followup to #11239. Unfortunately the fix implemented for #11236 was incorrect and it didn't solve the underlying issue of not rerendering component properly on forceUpdate.

This PR solves the issue and adds necessary test to make sure it's resolved properly this time.

if (typeof this._instance.shouldComponentUpdate === 'function') {
if (
typeof this._instance.shouldComponentUpdate === 'function' &&
this._forcedUpdate !== true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This can just be !this._forcedUpdate, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, _forcedUpdate is always a boolean

@gaearon
gaearon merged commit 779d23f into react:master Nov 3, 2017
Ethan-Arrowood pushed a commit to Ethan-Arrowood/react that referenced this pull request Dec 8, 2017
…eact#11439)

* Fix ReactShallowRenderer not rerendering when calling forceUpdate()

* Style nit
NMinhNguyen referenced this pull request in enzymejs/react-shallow-renderer Jan 29, 2020
…#11439)

* Fix ReactShallowRenderer not rerendering when calling forceUpdate()

* Style nit
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
…eact#11439)

* Fix ReactShallowRenderer not rerendering when calling forceUpdate()

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants