-
Notifications
You must be signed in to change notification settings - Fork 801
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
PureComponents might not be updated #944
Comments
Reported by @elisherer It has something to do with me using react-waterfall which isn't doing anything wrong (from my perspective). Class component Current state - could not create a red🛑 test to start with. |
Test added, I think the source of the problem is not |
@neoziro - changing PureComponent to Component in the original example does solve the problem in real. The problem still exists and easily reproducible (in complex example) |
@theKashey, I managed to recreate the problem without |
Pure Component just next to Context Consumer. Double kill! ☠︎ |
I’m using 4.0.1 and it works fine. Wanted to update to the latest version and ran into some issues with hot reloading. I have an example where I have nested PureComponents and changes aren’t being reloaded in a nested PureComponent. However, if I change it’s parent to Component it starts to work. |
Strange. I have almost the same situation in the tests - Pure inside Pure, and they works. |
For completeness:
|
:notsureif: <AsyncRouteComponent>
<HotHOC>
<PureComponent>
<Fragment>
<Component>
<PureComponent>// this works?
<PureComponent>// this works?
<PureComponent> // this works?
<PureComponent> // Change this one to Component and it starts working (and "this works?")
<PureComponent> // this works?
<PureComponent /> // <- does not hot reload (BUT ONLY THIS!)
</PureComponent>
</PureComponent>
</PureComponent>
</PureComponent>
</PureComponent>
</Component>
</Fragment>
</PureComponent>
</HotHOC>
</AsyncRouteComponent> |
Yeah this wasn’t totally correct. Sorry. <AsyncRouteComponent>
<HotHOC>
<PureComponent>
<Fragment>
<Component>
<PureComponent> // this works? Yes
<PureComponent> // this works? Yes
<PureComponent> // this works? Yes
<PureComponent_Row> // **Everything stops here** Change this one to Component and it starts working (and "this works?")
<PureComponent> // this works? No
<PureComponent /> // <- does not hot reload (BUT ONLY THIS!) No
</PureComponent>
</PureComponent_Row>
</PureComponent>
</PureComponent>
</PureComponent>
</Component>
</Fragment>
</PureComponent>
</HotHOC>
</AsyncRouteComponent> |
So, how |
The only thing I can think of is that the props that are being passed into |
I've tracked down the problem. Fixing... |
@elisherer - going to add your repo to our examples. Be be able to test it in the future |
@theKashey , PureComponent does not get updated if it's located after the 16.3 Context.Provider, is this a known issue?
Here's the smallest configuration reproducing this:
|
That is should fixed in the latest release. 4.2.0 adds support for Context and should solve this task. |
@theKashey , as I mentioned, I am already using 4.2.0, just before updating from 4.1.2, context blocked updates in nested components, now they work well, but PureComponents stop updating if located after context block. |
Ok, I fixed the case, when PureComponent is located inside Context, but not next. actually it should not be a problem. |
No errors in console and in my app, I've got proper provider with value, consumer children while pure components are actually redux connected components. I've just been reducing the structure required to reproduce this till I got down to the above. Should add example as a test case for TDD and see for yourself :) |
Just set |
@theKashey , yes, with
|
@IMalyugin - thanks for report. Fix will arrive soon. |
OK I tracked down my issue. This seems to have something to do with our use of lodash’s memoize function. When I do |
Actually, I believe the issue I reported earlier in this thread is fixed in 4.2.0 and #984 is a new one. |
fix: Context Provider could crash update, #944
Everything should fixed in v4.3.0 |
@theKashey Yep, it's all fixed now, thanks :) |
I've experienced something very similar when I'm using a React.Fragments. Everything hot reloads until the third or forth Fragment - then it halts. If unrelated I'll file another ticket but thought I'd first mention it here. |
Every time I announce: * Hey! At last it works! *, it doesn't :) |
@theKashey - I think you deserve a little more than some dribble that something looks like it may not work. I should be able to get you a much cleaner test case soon - or confirmation that I'm on drugs ;) |
Obliviously - React-Hot-Loader does not always work. |
Original problem - I could not find any test related to PureComponents at all.
The text was updated successfully, but these errors were encountered: