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

Skip null array items in `getDataFromTree` #1355

Merged
merged 2 commits into from Nov 29, 2017

Conversation

Projects
None yet
3 participants
@dan-lee
Copy link
Contributor

dan-lee commented Nov 25, 2017

I have the case that occasionally a component may return an array with a null value in it. Unfortunately this breaks the tree walker and eventually our server side rendering:

Cannot read property 'type' of undefined
at walkTree (/.../node_modules/react-apollo/react-apollo.umd.js:674:34)

From the React standpoint this should be totally fine: https://codesandbox.io/s/y0pl8pkwnx.

So in this PR I added a null check and tests to cover this case.

@meteor-bot

This comment has been minimized.

Copy link

meteor-bot commented Nov 25, 2017

@dan-lee: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@meteor-bot

This comment has been minimized.

Copy link

meteor-bot commented Nov 25, 2017

Fails
🚫

No CHANGELOG added.

Generated by 🚫 dangerJS

@jbaxleyiii

This comment has been minimized.

Copy link
Member

jbaxleyiii commented Nov 29, 2017

@dan-lee this is great! Thanks so much!

@jbaxleyiii jbaxleyiii merged commit e659ff9 into apollographql:master Nov 29, 2017

2 of 4 checks passed

Danger ⚠️ Danger found some issues. Don't worry, everything is fixable.
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
CLA Author has signed the Meteor CLA.
Details
bundlesize ./dist/index.min.js: 8.46kB < maxSize 8.6kB gzip
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment