A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/milankinen/livereactload/issues/8 below:

Loading React more than once is causing context issues w/ react-router. · Issue #8 · milankinen/livereactload · GitHub

Hope you can help or point me in the right direction, but I've been battling w/ this most of the day and finally realized it wasn't anything in my code. I took your 05 example and swapped out it with any example from here:

https://github.com/rackt/react-router/tree/master/examples

And it works fine on first render, but if you make a change I get a pretty horrendous message. Very much to do w/ context and the new way of handling things in React 0.13.

warning: owner-based and parent-based contexts differ (values: `2` vs `1`) for key (routeDepth) while mounting RouteHandler (see: http://fb.me/react-context-by-parent)
:3000/static/bundle.js:23498 Warning: Failed Context Types: Required context `router` was not specified in `Link`. Check the render method of `App`.
:3000/static/bundle.js:23498 Warning: owner-based and parent-based contexts differ (values: `undefined` vs `function (props, context) {
      // This constructor is overridden by mocks. The argument is used
      // by mocks to assert on what gets mounted.

      if ("production" !== process.env.NODE_ENV) {
        ("production" !== process.env.NODE_ENV ? warning(
          this instanceof Constructor,
          'Something is calling a React component directly. Use a factory or ' +
          'JSX instead. See: http://fb.me/react-legacyfactory'
        ) : null);
      }

      // Wire up auto-binding
      if (this.__reactAutoBindMap) {
        bindAutoBindMethods(this);
      }

      this.props = props;
      this.context = context;
      this.state = null;

      // ReactClasses doesn't have constructors. Instead, they use the
      // getInitialState and componentWillMount methods for initialization.

      var initialState = this.getInitialState ? this.getInitialState() : null;
      if ("production" !== process.env.NODE_ENV) {
        // We allow auto-mocks to proceed as if they're returning null.
        if (typeof initialState === 'undefined' &&
            this.getInitialState._isMockFunction) {
          // This is probably bad practice. Consider warning here and
          // deprecating this convenience.
          initialState = null;
        }
      }
      ("production" !== process.env.NODE_ENV ? invariant(
        typeof initialState === 'object' && !Array.isArray(initialState),
        '%s.getInitialState(): must return an object or null',
        Constructor.displayName || 'ReactCompositeComponent'
      ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));

      this.state = initialState;
    }`) for key (router) while mounting Link (see: http://fb.me/react-context-by-parent)
:3000/static/bundle.js:1896 Uncaught TypeError: Cannot read property 'makeHref' of undefined
:3000/static/bundle.js:23498 Warning: Failed Context Types: Required context `router` was not specified in `Link`. Check the render method of `App`.
:3000/static/bundle.js:23498 Warning: owner-based and parent-based contexts differ (values: `undefined` vs `function (props, context) {
      // This constructor is overridden by mocks. The argument is used
      // by mocks to assert on what gets mounted.

      if ("production" !== process.env.NODE_ENV) {
        ("production" !== process.env.NODE_ENV ? warning(
          this instanceof Constructor,
          'Something is calling a React component directly. Use a factory or ' +
          'JSX instead. See: http://fb.me/react-legacyfactory'
        ) : null);
      }

      // Wire up auto-binding
      if (this.__reactAutoBindMap) {
        bindAutoBindMethods(this);
      }

      this.props = props;
      this.context = context;
      this.state = null;

      // ReactClasses doesn't have constructors. Instead, they use the
      // getInitialState and componentWillMount methods for initialization.

      var initialState = this.getInitialState ? this.getInitialState() : null;
      if ("production" !== process.env.NODE_ENV) {
        // We allow auto-mocks to proceed as if they're returning null.
        if (typeof initialState === 'undefined' &&
            this.getInitialState._isMockFunction) {
          // This is probably bad practice. Consider warning here and
          // deprecating this convenience.
          initialState = null;
        }
      }
      ("production" !== process.env.NODE_ENV ? invariant(
        typeof initialState === 'object' && !Array.isArray(initialState),
        '%s.getInitialState(): must return an object or null',
        Constructor.displayName || 'ReactCompositeComponent'
      ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));

      this.state = initialState;
    }`) for key (router) while mounting Link (see: http://fb.me/react-context-by-parent)
:3000/static/bundle.js:10735 Uncaught TypeError: Cannot read property '_currentElement' of null

Basically what's happening is that on the second round I'm losing my context and it's blowing up react-router as it expects that. I digged further and realized that bundle.js is added again to the page on each livereload notify which may be the issue. I just came off of webpack dev b/c of some issues I had, but it seems like what is done there is very specific module loading and it seems like that is what is going on here, but again context is somehow not coming into play on livereactload refresh. However, maybe I'm missing something obvious?

Any help would be greatly appreciated! Thanks so much

Chris


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4