gaearon / react-deep-force-update

Force-updates React component tree recursively
MIT License
122 stars 19 forks source link

node.tag is never 2 for React v16.6 => never updates #14

Open wmertens opened 5 years ago

wmertens commented 5 years ago

This pertains to v4 beta 13, which code is not to be found in this repo :(

the beta checks node.tag and only processes nodes where node.tag === 2. However, in React v16.6 it seems that almost all nodes are a 1.

Hence, no updates.

gaearon commented 5 years ago

I removed that check from all active branches. Who uses the 4 beta? I’m not sure what that is.

wmertens commented 5 years ago

https://unpkg.com/react-deep-force-update@4.0.0-beta.13/

On Wed, Nov 14, 2018, 4:22 AM Dan Abramov <notifications@github.com wrote:

I removed that check from all active branches. Who uses the 4 beta? I’m not sure what that is.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gaearon/react-deep-force-update/issues/14#issuecomment-438524058, or mute the thread https://github.com/notifications/unsubscribe-auth/AADWlseFomKfUHDXKGhSkbfxtPr0ej_Vks5uu4yCgaJpZM4Yczd2 .

gaearon commented 5 years ago

I understand it’s on npm but I don’t remember working on that branch. It was likely somebody else. So I’m asking which project uses this.

wmertens commented 5 years ago

Some proprietary projects over here use them, but I have ascertained that v2 works just as well now. I use it to propagate semi-fixed property changes, like the current language and the current location.

So maybe v4 should get a beta14 that prints a warning? I started using it when v1 nor v2 worked for me, and I just assumed that a higher number is better.

Alternatively, make the current version be v4 :)

I still think that deep-force-update has a place in the ecosystem, even with the Context API, because I'm reasoning that that API adds a bunch of listeners like Redux does?

I may be wrong, in which case it would probably be better that I migrate to Context.

dgoldstein0 commented 5 years ago

hm, it sounds like you've been putting this library into production code? that sounds like quite a hack.

I've used it as a piece of react hot reloading support I've rolled for typescript+amd+requirejs, and it works great for it. It's useful because react code doesn't assume that code can change from under it, and so forcing updates is helpful for the hot reloading use case.

wmertens commented 5 years ago

It was that or reload the entire page and lose all state, or attach listeners to hundreds of elements. In retrospect I should probably have attached listeners but now I just use the new Context API.