scotch-io / react-flux-cart

Code for the tutorial by @kenwheeler: Create a Shopping Cart Using React.js and Flux
263 stars 132 forks source link

Typo in action constant name #6

Open pcavanaugh opened 9 years ago

pcavanaugh commented 9 years ago

Hello!

The constant used to select a variant is inconsistent. It ends up working out since we're emitting an undefined event type and checking for an undefined event type, but it's a bit confusing.

// FluxCartConstants.js
module.exports = keyMirror({
  CART_ADD: null,
  CART_REMOVE: null,
  CART_VISIBLE: null,
  SET_SELECTED: null,
  RECEIVE_DATA: null
});
  // FluxCartActions.js
  // Set currently selected product variation
  selectProduct: function(index) {
    AppDispatcher.handleAction({
      actionType: FluxCartConstants.SELECT_PRODUCT,
      data: index
    })
  }
// ProductStore.js
// Respond to SELECT_PRODUCT action
    case FluxCartConstants.SELECT_PRODUCT:
      setSelected(action.data);
      break;
ORESoftware commented 9 years ago

this should be fixed?

ORESoftware commented 9 years ago

I have this problem, and I think it's related to this open issue: http://stackoverflow.com/questions/32217986/error-in-react-lib-typeerror-type-is-undefined