question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v2 does not work with redux-observable

See original GitHub issue

Describe the bug This is a separate ticket to highlight the second issue I was having with V2 and redux-observable briefly mentioned in #260 . The issue I was having, was that for some reason I had to re-arrange my enhancer and middleware, otherwise my dispatched actions from the main process weren’t picked up by the renderer process. I am not sure if this should be documented or resolved.

This change is related to the API change to remove replayActionRenderer. Listening for and dispatching actions from the middleware instead of after the createStore has been created, like the V1 api, is causing the dispatched actions to not get picked up by the middleware. The renderer process is receiving an action, the reducer are being called because of it, but not the middleware. I think it is because when the enhancer is after the middleware in the compose function, the dispatch in the enhancer isn’t setup yet with the middleware.

I see 3 solutions here. Re-introduce replayActionRenderer, ~document the necessity to have the enhancer as the first item~, or fix it somehow inside the enhancer itself so that the simple API remains and the compose order is not so error-prone. But I am not sure if this is possible.

To Reproduce I may be able to provide a sample project if needed, but it will take some effort to set up.

My setup: Main process -> some action -> epic middleware -> action -> dispatched to renderer -> middleware not triggered (neither redux-logger or redux-observable)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
sneljo1commented, Feb 9, 2021

@matmalkowski No, indeed, that may have been over exaggerated, wasn’t sure yet 1 hour ago if more changes were needed. Will send a PR your way as soon as I get things cleaned up. 🙂

2reactions
sneljo1commented, Feb 9, 2021

@Slapbox I will just create a PR to this repo as soon as I am happy with it. No need to start yet another fork. That repo is just to create a PR from.

With the above approach,replayActionRenderer will not need to be introduced. Something extra will just be introduced to replace the current enhancer.

And no, I just removed those hacks while now preparing these changes, so I will not be able to share these anymore.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting - redux-observable
This is a place to share common problems and solutions to them. If your problem isn't yet listed here or you need other...
Read more >
About 2.0.0 · Issue #738 · redux-observable/redux ... - GitHub
When I'm working with Redux I still use redux-observable, it's not actively developed but I don't need it to be since I don't...
Read more >
Epics not triggering in Redux observable with Redux toolkit
Looks like the redux store is not changing, loginUser action is triggering but looks like ofType(LOGIN_USER) is not catching it, I saw in...
Read more >
Redux-Observable will solve your state problems. - ITNEXT
Solving Common Async State Issues. Everyone using Redux will eventually find themselves in need of a way to handle async actions. There are...
Read more >
redux-observable/redux-observable - Gitter
I am facing the problem of setting up redux action in getInitialProps of next.js ... For which, I am using the observables I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found