gaearon/flux-react-router-example

Cannot execute the search

cybersiddhu opened this issue · 2 comments

As soon as i hit the Go! button i see the following error

Uncaught TypeError: Cannot read property 'dispatch' of undefined  AppDispatcher.js:10

Here is the relevant line

class AppDispatcher extends Dispatcher {
  /**
   * Dispatches three actions for an async operation represented by promise.
   */
  dispatchAsync(promise, types, action = {}) {
    const { request, success, failure } = types;

    this.dispatch(request, action);   === > Error here
    promise.then(
      response => this.dispatch(success, { ...action, response }),
      error => this.dispatch(failure, { ...action, error })
    );
  }

Hey, thanks for noticing. I don't know how it worked before.
I fixed this by completely getting rid of inheritance there and just delegating to a Flux dispatcher instance.

Alright thanks a ton