jk-gan / flipper-plugin-redux-debugger

Flipper plugin for Redux in React Native
MIT License
117 stars 20 forks source link

Cannot read property 'type' of undefined. #30

Closed zacdemi closed 3 years ago

zacdemi commented 3 years ago
TypeError: Cannot read property 'type' of undefined
    at ReduxViewer.buildRow (/Users/zacdemi/.flipper/thirdparty/flipper-plugin-redux-debugger/dist/bundle.js:872:81)
    at /Users/zacdemi/.flipper/thirdparty/flipper-plugin-redux-debugger/dist/bundle.js:892:42
    at Array.map (<anonymous>)
    at ReduxViewer.render (/Users/zacdemi/.flipper/thirdparty/flipper-plugin-redux-debugger/dist/bundle.js:892:28)
    at qi (file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:53:71628)
    at pi (file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:53:71427)
    at gl (file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:53:112555)
    at bk (file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:53:98507)
    at ak (file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:53:98435)
    at Tj (file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:53:98298)
    at Lj (file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:53:95289)
    at file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:53:44912
    at e.unstable_runWithPriority (file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:55:3794)
    at gg (file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:53:44689)
    at jg (file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:53:44857)
    at ig (file:///Applications/Flipper.app/Contents/Resources/app/bundle.js:53:44792
plwai commented 3 years ago

Can you provide your configuration for the createDebugger of redux- flipper middleware in your application?

If possible, can you also provide an example action type you trigger the error?

zacdemi commented 3 years ago

Yes, thanks.

import { createStore, applyMiddleware, combineReducers } from 'redux';
import logger from 'redux-logger';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunk from 'redux-thunk';
import * as reducers from '../reducers';

const middlewares = [];

if (process.env.REACT_APP_NODE_ENV !== 'production') {
  const createDebugger = require('redux-flipper').default;
  middlewares.push(createDebugger(), thunk, logger);
} else {
  middlewares.push(thunk);
}

const appReducer = combineReducers({ ...reducers });

const rootReducer = (state, action) => {
  let nextState = state;
  if (action.type === 'USER_LOGOUT') {
    nextState = undefined;
  }
  return appReducer(nextState, action);
};

const store = createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(...middlewares)),
);

export default store;

And it happens when this action is triggered.

export const setCurrentMode = mode => async dispatch => {
  await AsyncStorage.setItem('current_mode', mode);
  return dispatch({
    type: sessionTypes.SET_CURRENT_MODE,
    payload: { mode },
  });
};
jk-gan commented 3 years ago

This is fixed in version 2.0.0