Yomguithereal / react-blessed

A react renderer for blessed.
MIT License
4.46k stars 177 forks source link

react-blessed not working with react-redux #115

Closed zcaudate closed 3 years ago

zcaudate commented 3 years ago

Copying from the response to a question I asked here

function flushPassiveEffects() {
  if (passiveEffectCallbackHandle !== null) {
    cancelPassiveEffects(passiveEffectCallbackHandle);
}
Yomguithereal commented 3 years ago

Hello @zcaudate, this is unfortunate indeed. But you seem to have a better understanding of the issue than I have currently and thus I was wondering whether you would like to attempt a PR to fix the problem, maybe by upgrading the underlying reconciler?

zcaudate commented 3 years ago

@Yomguithereal Hahaha. No, not at all. That was from one of the the maintainers of the redux project. I'm coming in to react from vue so am doing some simple projects to better understand the ecosystem.

markerikson commented 3 years ago

Hiya! Yeah, the issue here is that react-blessed has a dependency on "react-reconciler": "^0.20.4". Per my investigation, that version of react-reconciler has a bug in how it checks for running passive effects, and this is causing React-Redux to run a subscription cleanup when it shouldn't.

As of react-reconciler@0.21.0, that chunk of the code has been completely rewritten.

The current version is react-reconciler@0.26.1.

Per that SO discussion, there's a couple other tweaks that we should make on the React-Redux side as well, but the real bugfix is to upgrade react-blessed to use the latest version of react-reconciler. I'm not sure how much additional effort might be needed to update the host config after bumping the dependency version, though.

zcaudate commented 3 years ago

@markerikson is it just as simple as upgrading the react-reconciler version?

I'd like to give it a go.

I did some quick and dirty (using immer instead of redux)

Maybe this is related but I found that when I'm using an async timer to switch state, the UI updates once and does not update again

zcaudate commented 3 years ago

@Yomguithereal: are there any instructions for compiling this library?

Yomguithereal commented 3 years ago

@zcaudate I am not sure to precisely know what you mean by "compiling" in this context. Just install deps with npm i, run the units tests with npm test and, most importantly, try to run some examples using npm run demo to see if what you did still works.

zcaudate commented 3 years ago

Sweet I'll take a look in the next couple of days

Just for completeness' sake with the counter examples:

I was hoping to get snake and pong working but the async animation thing not working kinda put a damper on it.

Yomguithereal commented 3 years ago

v0.7.0 should have fixed this issue? Can someone confirm and close the issue or ask me to do it please?

markerikson commented 3 years ago

I just tried updating the bug repro counter project I was given, and it does appear to be updating correctly now. So, I'm gonna give a thumbs-up.

zcaudate commented 3 years ago

yep. it's working for me too!