Skip to content

Switch to parent-based context. Fixes #2112.#3615

Merged
jimfb merged 1 commit into
react:masterfrom
jimfb:enable-new-context
Apr 9, 2015
Merged

Switch to parent-based context. Fixes #2112.#3615
jimfb merged 1 commit into
react:masterfrom
jimfb:enable-new-context

Conversation

@jimfb

@jimfb jimfb commented Apr 7, 2015

Copy link
Copy Markdown
Contributor

Switch to parent-based context. Fixes #2112.

@sophiebits

Copy link
Copy Markdown
Collaborator

Can we add a new test that would have failed with owner-based context?

@jimfb

jimfb commented Apr 7, 2015

Copy link
Copy Markdown
Contributor Author

Yep, good idea, done.

@mridgway

mridgway commented Apr 7, 2015

Copy link
Copy Markdown
Contributor

Seems like ReactElement._context and ReactContext should be removed since they are no longer used with parent contexts.

@jimfb

jimfb commented Apr 7, 2015

Copy link
Copy Markdown
Contributor Author

@mridgway That's a super easy change, but I'd like to separate functional changes from cleanup changes (which don't affect functionality) to make code reviews easier. That way, someone has a chance of actually understanding what's going on in any given commit (removing _context will touch a bunch of lines, making it harder to read the PR). If @spicyj would like it to be part of the same commit, I'll go ahead and amend.

@jimfb jimfb force-pushed the enable-new-context branch from e5c2146 to a51686b Compare April 7, 2015 21:43
@sophiebits

Copy link
Copy Markdown
Collaborator

Having all the cleanup in one commit is preferable to me.

@jimfb jimfb force-pushed the enable-new-context branch from a51686b to 7d44917 Compare April 7, 2015 21:49
@jimfb

jimfb commented Apr 7, 2015

Copy link
Copy Markdown
Contributor Author

Ok, easy money, done.

@mridgway

mridgway commented Apr 7, 2015

Copy link
Copy Markdown
Contributor

If you do the cleanup in a separate commit and revert this change then the reverted changes won't function correctly unless you revert the cleanup as well. Seems like it creates unnecessary dependencies between commits.

@jimfb

jimfb commented Apr 7, 2015

Copy link
Copy Markdown
Contributor Author

Cherry-picking reverts can be exceedingly difficult anyway, because people inevitably touch the same code (especially when you have huge commits, you're likely to overlap/conflict somewhere, and merging commits exacerbates the problem). So it's a loose-loose situation.

Regardless, it's a style difference, I don't have a strong preference either way, already fixed it as per @spicyj.

@sebmarkbage

Copy link
Copy Markdown
Contributor

I kind of prefer functional changes in a separate commit too, although since PRs allow multiple commits they could be merged.

Accepted, but DON'T land until we've solved the layers issue since that will get this reverted.

@gaearon

gaearon commented Apr 9, 2015

Copy link
Copy Markdown
Collaborator

What's the issue with layers? Can I read about it somewhere?

@sebmarkbage

Copy link
Copy Markdown
Contributor

Nope, it is an internal FB issue.

@sebmarkbage

Copy link
Copy Markdown
Contributor

Basically, there is no way to pass a context to a new subtree - which was also true before but some people hacked around it so we have to undo those hacks.

@gaearon

gaearon commented Apr 9, 2015

Copy link
Copy Markdown
Collaborator

Ah, the mystical ReactLayer from @chenglou's gists.

@jimfb

jimfb commented Apr 9, 2015

Copy link
Copy Markdown
Contributor Author

Layer issue is solved, pending a final review and sync with www.

jimfb added a commit that referenced this pull request Apr 9, 2015
Switch to parent-based context.  Fixes #2112.
@jimfb jimfb merged commit 0185c68 into react:master Apr 9, 2015
@sebmarkbage

Copy link
Copy Markdown
Contributor

Well ideally we should land that (and prepare the callers) first since we won't be able to sync React internally now.

On Apr 9, 2015, at 1:21 PM, Jim notifications@github.com wrote:

Layer issue is solved, pending a final review and sync with www.


Reply to this email directly or view it on GitHub.

@skiano

skiano commented May 29, 2015

Copy link
Copy Markdown

@jimfb

I am excited about this feature, so I built react at 7d44917.

On that commit, I can use parent based contexts (as I see in the unit test that was added)

However, I when I try v0.13.3 I can't seem to get it working.

Was this reverted or changed between then and now?

@sophiebits

Copy link
Copy Markdown
Collaborator

0.13.3 only includes 0.13 plus individually cherry-picked commits; 0.14 will include everything that's currently in master.

@skiano

skiano commented May 29, 2015

Copy link
Copy Markdown

Thanks for the info,

Sorry if this info is elsewhere, but does anyone have an idea about how soon 0.14 might go out?

@sophiebits

Copy link
Copy Markdown
Collaborator

After the things in #3220 get done.

@mjackson

Copy link
Copy Markdown
Contributor

Just wanted to say THANK YOU to @jimfb and everyone else who worked on this change. This feels like the right way to go.

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.

Switch the Context to use the Parent tree instead of the Owner tree

8 participants