Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Bail out on fibers that returned false from shouldComponentUpdate #804

Merged
merged 2 commits into from
Jun 9, 2017

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Jun 7, 2017

If facebook/react#9887 gets in, this fixes #337.
Should also make DevTools faster on updates.

Will only work for Fiber.

Callback: 32, // 0b00100000
Err: 64, // 0b01000000
Ref: 128, // 0b10000000
};
Copy link
Contributor

@bvaughn bvaughn Jun 7, 2017

Choose a reason for hiding this comment

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

This concerns me a bit. We might re-arrange add side-effect types in the future and this could get out of sync easily (either in GitHub master, or in a specific deployed version of DevTools vs React).

Could we maybe pass these values in as a named parameter to __REACT_DEVTOOLS_GLOBAL_HOOK__.inject or something?

If we have to hard-code, it seems better to limit it to only the Bailout value (which seems unlikely to change, assuming your inline comment is followed). This way we aren't tempted to do meaningful things with the other values (which may become invalid over time).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this to match TypesOfWork which I previously inlined but if I recall correctly somebody asked me to un-inline it :-). I agree about just using the values directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not worried about Bailout number changing because I left a comment in React itself about it, and React repo logic also depends on it being 1 specifically.

I guess let's remove others, and add notes to React repo for constants we depend on externally (there's some other ones too outside DevTools).

I'd avoid injection for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not worried about Bailout number changing because I left a comment in React itself about it, and React repo logic also depends on it being 1 specifically.

Agreed. 😄

@gaearon
Copy link
Contributor Author

gaearon commented Jun 8, 2017

We probably need to wait with landing this until FB www sync happens. Since we now skip fibers that don't have 1 in effect tag, updates probably won't work with existing alphas.

@gaearon
Copy link
Contributor Author

gaearon commented Jun 8, 2017

Which also means we need an RN sync for this 😞

@gaearon gaearon merged commit 6cddef6 into master Jun 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does "Trace React Updates" respect shouldComponentUpdate short-circuits?
3 participants