HenrikJoreteg / redux-bundler

Compose a Redux store out of smaller bundles of functionality.
https://reduxbundler.com
583 stars 46 forks source link

Reactors not working as expected on react-native #18

Closed quarkcore closed 6 years ago

quarkcore commented 6 years ago

On react-native reactors seem to not get executed. On the web the same bundle works like a charm.

Would really help to clearify this issue, because this project is the best solution for decoupled code sharing between redux apps i have worked with so far.

i have no idea why this happens but try to do further investigation myself. anybody an idea?

aulneau commented 6 years ago

@quarkcore did you find a fix for this?

quarkcore commented 6 years ago

@aulneau actually not. the execution works now anyhow. it was some trouble with the log i guess.

right now it looks like the action i return doesnt get dispatched. do you run in similar issues?

aulneau commented 6 years ago

I haven't yet but I am planning on exploring how well this works with RN in the coming days. If I run into issues I'll report back

quarkcore commented 6 years ago

@aulneau be sure to checkout https://github.com/HenrikJoreteg/redux-bundler/issues/15 then.

if i get it working i will report it here. @HenrikJoreteg any idea? cheers!

HenrikJoreteg commented 6 years ago

Hey @quarkcore! Thanks for reporting this. Is it just never running the reactors?

Without knowing exactly what's happening, (I really haven't used RN much, personally). If so, I'd suggest looking here: https://github.com/HenrikJoreteg/redux-bundler/blob/master/src/bundles/create-reactor-bundle.js#L66-L74

That's what actually will grab the reactor it's supposed to run and then dispatch it.

quarkcore commented 6 years ago

Hi @HenrikJoreteg, it runs the reactor like i wrote above. my logger was misleading me on that one.

nonetheless the returned action never gets dispatched. the code snippet you are mentioning looks like a good starting point for debugging.

thanks for the quick answer!

HenrikJoreteg commented 6 years ago

@quarkcore oh sorry I missed that. Do you mind sharing what you're returning from the reactor? Is it an action object? or does it call an action creator or what?

quarkcore commented 6 years ago

@HenrikJoreteg my plan is to share a whole bundle between a native and web app. so the return value of the reactor sits in the bundle directly. i tried to return in both ways without success.

there were problems (that should be solved) with window.requestIdleCallback on RN https://github.com/facebook/react-native/issues/9579 and thats what redux-bundler tries to use in its ric util. i inspect that further tommorow.

quarkcore commented 6 years ago

@HenrikJoreteg It was my fault! I didnt realized that the reactionBundle isnt composed by default. In react-native we need to use composeBundlesRaw(...bundles). Because for example the debugBundle kicks errors with react-native if remote debugging is off due to the use off extened console mehtods like console.groupCollpase().

so problem solved. maybe if i can find some time im able to tune the debugBundle to work with react-native too. its likely to be an helpful feature. if so to do i will open an issue to discuss how we can solve that!

HenrikJoreteg commented 6 years ago

@quarkcore ah, cool. Glad you got it sorted out. It would be cool if you could add some notes here about what changes you needed to make: https://github.com/HenrikJoreteg/redux-bundler/blob/master/docs/guides/patterns.md