0

I'm loading it like that:

const store = createStore(
  AppReducer,
  composeEnhancers(applyMiddleware(createDebounce(), thunkMiddleware,
    websocketMiddleware)),
  );

I've got the following action:

export const toggleCardLayersMenu = (index, value) => ({
  type: "CARD:TOGGLE_LAYERS_MENU",
  index: index,
  value: value,
});

Which I dispatch something to open a menu and something to close it.

Now, the chrome extension display the action with a small delay if the action is used to open the menu, and won't display the action at all if it's used to close the menu.

It occurs only with that specific action. What are the possible causes, and what can be done?

Edit:
This is where I dispatch the action:

...
<IconButton
  onClick={ e => dispatches.toggleCardLayersMenu(e.currentTarget) }
  ><LayersIcon />
</IconButton>
<Menu
  anchorEl={ card.menuBtnElem }
  open={ card.isMenuOpen }
  onRequestClose={ () => dispatches.toggleCardLayersMenu(null) }
  style={ styles.menu }
>
...

This is the dispatchToProps():

const mapDispatchToProps = (dispatch, ownProps) => ({ dispatches: {
updateCardLayers(value) {
  dispatch(displayActions.updateCardLayers(ownProps.index, value));
},
toggleCardLayersMenu(value) {
  dispatch(displayActions.toggleCardLayersMenu(ownProps.index, value));
},
...
galah92
  • 3,621
  • 2
  • 29
  • 55
  • Can you share (part of) the exact code where your'e dispatching the action, both when it works and when it fails? – jonahe Aug 31 '17 at 10:26
  • 1
    Yep, I added it. – galah92 Aug 31 '17 at 11:10
  • Is it just that the action doesn't show in devtools, or doesn't it fire at all (no change in the redux state for example)? If the action doesn't work at all: Have you tried replacing the `onRequestClose` callback with something simpler ( like `() => alert('test')`), just to see if the event is even firing? – jonahe Aug 31 '17 at 11:35
  • If the devtool tab is shown, sometimes it get fired with delay, something it won't fire at all. If the devtool tab is closed then it works well. – galah92 Aug 31 '17 at 12:49
  • Ok, thanks for the clarification. I'm afraid I'm not going to be able to solve this (sorry), so I'll just wish you good luck in your debugging! – jonahe Aug 31 '17 at 13:26

0 Answers0