Reactotron: All actions are wrapped?

Created on 10 Nov 2016  路  5Comments  路  Source: infinitered/reactotron

I'm testing out the redux integration, but for some reason all my actions appear in Reactotron as wrapped in another action which makes it very hard to see at a glance what is happening:

screen shot 2016-11-10 at 13 11 39

Is this an option I have to configure or?

Most helpful comment

It's not directed related to the extension itself, but to redux-devtools-instrument's enhancer, which is lifting the store and should be always the last in the compose. window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ takes care of it, but lately it's wrapped by Reactotron's createStore.

@skellock's snippet should help.

All 5 comments

Can you show us how you are calling your actions? I ask this because I am not seeing this in my use of Reactotron.
screen shot 2016-11-10 at 7 16 05 am

Even with a payload I don't see this happening:
screen shot 2016-11-10 at 7 17 24 am

Nevermind I've found what it is, it was redux devtool's composer that was adding its own wrapping to the actions:

const composeEnhancers = (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)
    ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__()
    : compose;

const store = Reactotron.createStore(reducers, initialState, composeEnhancers(middlewares));

If I switch it to just compose(middlewares) here it works

Good stuff!

Ahh. You raise a good point here though.

I'm doing the same thing (in spirit) as @zalmoxisus. We're both trying to make sure we're in front & behind the call to create store so we can maintain references.

All Reactotron.createStore does is inject the right wrappers at the right time.

A short-term work around might be to do the work of Reactotron.createStore manually.

// first wrap your reducer to take advantage of Reactotron's state uploading/downloading
const tronducer = Reactotron.createReplacementReducer(rootReducer)

// add an additional enhancer to your list so we can monitor redux actions
const enhancers = composeEnhancers(middlewares, Reactotron.createActionTracker())

// then create your store as usual
const store = createStore(tronducer, enhancers)

// then tell Reactotron about the store so we're able to dispatch events & query the state tree from Reactotron
Reactotron.setReduxStore(store)

As a longer-term fix, I can probably detect window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__() and play nicely with redux dev tools.

Caveat: I didn't test that code, so this is pretty much me talking out of my ass right now. I feel like it should work tho. :)

It's not directed related to the extension itself, but to redux-devtools-instrument's enhancer, which is lifting the store and should be always the last in the compose. window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ takes care of it, but lately it's wrapped by Reactotron's createStore.

@skellock's snippet should help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Eyesonly88 picture Eyesonly88  路  4Comments

skellock picture skellock  路  4Comments

fkereki picture fkereki  路  3Comments

lndgalante picture lndgalante  路  4Comments

sylar picture sylar  路  4Comments