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

Supporting passing context to static rendering #429

Merged
merged 2 commits into from
Feb 27, 2017

Conversation

hunterbmt
Copy link
Contributor

@hunterbmt hunterbmt commented May 31, 2016

Supporting passing context to static rendering. Not yet support .context() API


describeWithDOM('render', () => {
describe('context', () => {
describeIf(!REACT013, 'context', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@hunterbmt it doesn't look like this describeIf block is wrapping all the new context tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's correct @aweary. I fixed it. Sorry for this basic mistake

Copy link
Contributor

@lencioni lencioni left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! Will you please add documentation for this change and rebase onto the latest master when you have a chance?

@gerardmrk
Copy link

Hello there, is this still happening? I would really like this feature, thanks!

@ljharb
Copy link
Member

ljharb commented Feb 21, 2017

@hunterbmt are you still interested in completing this PR?

If not, @gerardmrk, if you can point me to a commit that adds the documentation, I can cherry-pick it onto this PR, and do the rebase.

@hunterbmt
Copy link
Contributor Author

@ljharb I will finish it today (GMT +7). Sorry for this delay, I thought I finished it already but obviously, I'm not 😿

@hunterbmt
Copy link
Contributor Author

@ljharb could you help me to double check and merge this PR ?
Please let me know if I need to update anything.

Regards,

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Seems good but let's get more eyes on it.

@lencioni lencioni dismissed their stale review February 21, 2017 19:38

I don't have time to review again right now and I don't want to be a blocker.

src/render.jsx Outdated
if (options.context && (node.type.contextTypes || options.childContextTypes)) {
const childContextTypes = node.type.contextTypes || {};
if (options.childContextTypes) {
objectAssign(childContextTypes, options.childContextTypes);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Won't this mutate node.type.contextTypes if it exists?

Copy link
Member

Choose a reason for hiding this comment

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

good catch, let's not mutate

Copy link
Collaborator

@aweary aweary left a comment

Choose a reason for hiding this comment

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

@hunterbmt let's avoid mutating node.type.contextTypes. We can just assign childContextTypes a newly constructed object if options.childContextTypes exists

edit: yeah do what @ljharb recommended below

Otherwise it LGTM! Great work and thanks for doing this 🎉

@ljharb
Copy link
Member

ljharb commented Feb 21, 2017

or better:

const childContextTypes = objectAssign({}, node.type.contextTypes || {}, options.childContextTypes);

@hunterbmt
Copy link
Contributor Author

@ljharb nice catch. I updated the PR.

@hunterbmt
Copy link
Contributor Author

@ljharb could we merge this PR ?

@ljharb
Copy link
Member

ljharb commented Feb 27, 2017

@hunterbmt sure, could you rebase onto latest master?

@hunterbmt
Copy link
Contributor Author

@ljharb I already do that via github UI (you could check the last "merge" commit)

@ljharb
Copy link
Member

ljharb commented Feb 27, 2017

@hunterbmt that's a merge, not a rebase. A rebase would leave behind zero merge commits, and requires being done on the command line.

If you're unable to do it, I can take care of it for you.

@hunterbmt
Copy link
Contributor Author

@ljharb I rebased master into my branch. Could you help me to merged this one ?

@ljharb
Copy link
Member

ljharb commented Feb 27, 2017

@hunterbmt would you also mind checking the "allow edits" checkbox in the right hand column?

@ljharb ljharb self-assigned this Feb 27, 2017
@hunterbmt
Copy link
Contributor Author

@ljharb Already done.

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.

5 participants