Coder Social home page Coder Social logo

Comments (9)

larrymyers avatar larrymyers commented on June 27, 2024

Can you get me some more details so I can reproduce?

  1. Are you navigating to a url not handled by the router?
  2. Is the componentWillUnmount lifecycle method not being called on the component you're adding the RouterMixin to?

If the DOM tree isn't changing, then the event listener shouldn't be lost.

from react-mini-router.

poshaughnessy avatar poshaughnessy commented on June 27, 2024

Ah, that's good to know - perhaps I'm inadvertently doing something a bit strange then!

Let me see if I can reduce it down to a test case that I can share, then. I'll post an update here soon.

from react-mini-router.

larrymyers avatar larrymyers commented on June 27, 2024

Any updates on what the issue was?

from react-mini-router.

poshaughnessy avatar poshaughnessy commented on June 27, 2024

Sorry for the delay, Larry. Just trying to build a little test case now. Hope to post it here tonight or tomorrow.

from react-mini-router.

poshaughnessy avatar poshaughnessy commented on June 27, 2024

OK, here is a quick test case: https://github.com/poshaughnessy/react-mini-router-test

NB. I used a standalone version of your library, that I made using browserify on the command line, because:

  • I didn't want to introduce a CommonJS compile step, for this simple test case
  • I tried installing it with bower, but it errored with: ENOTFOUND Package juliangruber/isarray=juliangruber/isarray not found?

Instructions / steps to reproduce the problem (also included in the README):

  • npm install
  • node server
  • Fire up localhost:3000 in the browser
  • (Bring up the Network tab in the debugging tools so you can see when a full page request is made)
  • Click Page one - this will load without a full page request
  • Click Page two - this now causes a full page request

Tested in Chrome v40 and Firefox v35.

Hope this helps!

from react-mini-router.

larrymyers avatar larrymyers commented on June 27, 2024

@poshaughnessy Thanks! That will be extremely helpful in debugging. I've attached this issue to the 1.1 milestone, so expect to see it resolved this month.

from react-mini-router.

holyjak avatar holyjak commented on June 27, 2024

There is actually a very simple workaround, at least for us it worked well - wrap the component produced by the route function (that is different for each route) into a <div> - which will get the listener attached to itself, does not change, and thus doesn't lose the listeners.
I.e. instead of

render: function() {
        return this.renderCurrentRoute();
    },

do this

render: function() {
        return (<div>{this.renderCurrentRoute()}</div>);
    },

in your root component with the RouterMixin.

from react-mini-router.

rapind avatar rapind commented on June 27, 2024

I ran into this issue today. @jakubholynet 's solution worked.

from react-mini-router.

 avatar commented on June 27, 2024

Still running into this, @jakubholynet's solution helped me out! Thank you. @larrymyers it'd be awesome if this was noted on the README if the code fix is a little ways off!

from react-mini-router.

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.