Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Skip null array items in getDataFromTree #1355

Merged
merged 2 commits into from
Nov 29, 2017
Merged

Skip null array items in getDataFromTree #1355

merged 2 commits into from
Nov 29, 2017

Conversation

dan-lee
Copy link
Contributor

@dan-lee 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.

@apollo-cla
Copy link

@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/

@apollo-cla
Copy link

Fails
🚫

No CHANGELOG added.

Generated by 🚫 dangerJS

@jbaxleyiii
Copy link
Contributor

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

@jbaxleyiii jbaxleyiii merged commit e659ff9 into apollographql:master Nov 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants