Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRefactor dataForChild on DocumentType.Mutation to use new bound funct… #772
Conversation
helfer
approved these changes
Jun 14, 2017
Thanks @baerrach, I think this is great! I'd be okay with merging this without a test, but if @jbaxleyiii has some ideas for testing, it would be great to add one. I assume testing for re-renders is a solved problem, so there should be some prior art. If not, we should document it and write a blog post about it |
This comment has been minimized.
This comment has been minimized.
Yes, I'm all for writing tests with PRs. |
This comment has been minimized.
This comment has been minimized.
I'd be happy to show you how to test this! I'm out of town starting tonight
so it won't be until Sunday though
…On Wed, Jun 14, 2017, 7:51 PM Barrie Treloar ***@***.***> wrote:
Yes, I'm all for writing tests with PRs.
And I need to know how to do this for my own work. So I'm keen to learn.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#772 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEvMsEpU22xWPM2GZl18Gnh9Cskx-QLZks5sEHHpgaJpZM4N4e1P>
.
|
This comment has been minimized.
This comment has been minimized.
I'm in no rush. I also just found How to Fork and Patch NPM Modules so I can stop manually editing files in node_modules. |
This comment has been minimized.
This comment has been minimized.
derek-duncan
commented
Jun 21, 2017
@baerrach thanks for tackling this one. I just wanted to note that all of the functions in the Functions in
|
This comment has been minimized.
This comment has been minimized.
Yes, its a can of worms that needs looking at thoroughly. First step might be to write tests to make sure things aren't re-rendering unnecessarily, then that will give people a list of things to work on. With a set of guidelines in place on how to resolve the typical issues other people should be able to chip in and fix it up bit by bit. |
baerrach commentedJun 13, 2017
Attempt at fixing #725
dataForChild previously returned a new function for type DocumentType.Mutation
causing React shallowEqual render optimizations to fail.
Refactored the mutation specific code into its own method with a binding to
'this' in the constructor.
Haven't create a test case for this as all the tests render nulls, and this only shows up in real use on multiple renders. I'm not enough of an expert on React and testing to know how to do this properly.
TODO: