Coder Social home page Coder Social logo

Comments (8)

milankinen avatar milankinen commented on May 22, 2024

The reason for this behavior is that LiveReactload tries to reload react-router twice which -- causing such strange invariant violations.

Unfortunately I haven't found any silver bullet yet, but instead you can use the hack described in #43 gist.

from livereactload.

dcwardell7 avatar dcwardell7 commented on May 22, 2024

Thanks for responding.

Yes, I saw the gist and the issue you linked too. What hack are you referring to specifically? Is it line 35 this.context.router.transitionTo('/');?

from livereactload.

milankinen avatar milankinen commented on May 22, 2024

Nope. The hack is to create and run routes inside window.onload function so that they are not run twice.

This however has a negative side effect: changes to your route definitions are not hot-reloaded.

from livereactload.

dcwardell7 avatar dcwardell7 commented on May 22, 2024

I have done more diagnosing and found the issue.

The error I experienced seems to occur whenever I cause a reload while I'm "in a Route." As an example from your gist, if I follow a taco Route and then change some code, I get the above mentioned error (though that particular example will complain about Uncaught TypeError: Cannot read property 'getCurrentParams' of undefined before it gets to the Invariant Violation). The same behavior occurs if I specify a DefaultRoute.

The window.onload solution does not resolve the error.

from livereactload.

milankinen avatar milankinen commented on May 22, 2024

Aah I get it... react-router is de facto nowadays so maybe I should try to implement a "built-in" for it (like react/addons)

from livereactload.

zrosenbauer avatar zrosenbauer commented on May 22, 2024

+1

from livereactload.

milankinen avatar milankinen commented on May 22, 2024

Could you check if this problem is solved in the brand new 2.0.0-alpha2 version? https://github.com/milankinen/livereactload/tree/2.x.x

from livereactload.

milankinen avatar milankinen commented on May 22, 2024

Closing this one since there are no new replies since Sep 18.

from livereactload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.