infinitered / reactotron-redux

The redux plugin for reactotron that allows tracking redux actions and state
MIT License
10 stars 3 forks source link

Android production build - null is not an object (evaluating 's.getState') #8

Closed LuckyLuky closed 5 years ago

LuckyLuky commented 5 years ago

Might seem like a duplicate of #317, but this is actually a separate issue.

Once I import the Reactotron instance to my index file, although I use it to create store conditionally, inside if (__DEV) condition, the app immediately crashes.

I've figured out that if I initialize Reactotron inside a factory function, which I call inside the __DEV__ condition, everything works fine.

The original config looks like this:

const reactotron
    .configure()
    .useReactNative()
    .use(reactotronRedux())
    .connect()

export default reactotron

With factory function:

export const initReactotron = () => (
  Reactotron
    .configure()
    .useReactNative()
    .use(reactotronRedux())
    .connect()
)

I suspect that reactotronRedux plugin could be the reason.

rmevans9 commented 5 years ago

Could you please provide the full stacktrace?

LuckyLuky commented 5 years ago

I'm not sure if the stacktrace will be of any help, since it's pretty generic, but here it is:

image

rmevans9 commented 5 years ago

I am going to transfer this issue over to the reactotron-redux repo as that is where the code in question lives now.

nicholascm commented 5 years ago

thank you @LuckyLuky - this is only way I could get this working.

rmevans9 commented 5 years ago

This was caused because the store was trying to be used before everything was wired up. v3.0.0 has a guard against this so this should no longer happen!