Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Active is true when it _really_ should not be (super-simple use case) #158

Open
mercmobily opened this issue Nov 15, 2016 · 3 comments
Open

Comments

@mercmobily
Copy link

mercmobily commented Nov 15, 2016

This is a simple use-case for app-route and app-location.
To replicate it, just polymer init an app called pp and copy over pp-app.html with this:

<link rel="import" href="../../bower_components/polymer/polymer.html">

<link rel="import" href="../../bower_components/app-route/app-route.html">
<link rel="import" href="../../bower_components/app-route/app-location.html">

<dom-module id="pp-app">
  <template>
    <style>
      :host {
        display: block;
      }
    </style>

    <app-location route="{{route}}"></app-location>

    <app-route route="{{route}}" pattern="/:page" data="{{routeDataPage}}" tail="{{tailPage}}" active="{{activePage}}"></app-route>

    <app-route route="{{tailPage}}" pattern="/:city" data="{{routeDataCity}}" tail="{{tailCity}}" active="{{activeCity}}"></app-route>

    <app-route route="{{tailCity}}" pattern="/:category" data="{{routeDataCategory}}" active="{{activeCategory}}"></app-route>

    <a href="/">Root</a>
    <a href="/p">Page</a>
    <a href="/p/perth">Perth</a>
    <a href="/p/perth/cat1">Cat1</a>


    <p>route: {{_o(route)}}</p>

    <p>activePage and routeDataPage: {{activePage}} {{_o(routeDataPage)}}</p>
    <p>activeCity and routeDataCity: {{activeCity}} {{_o(routeDataCity)}}</p>
    <p>activeCategory and routeDataCategory: {{activeCategory}} {{_o(routeDataCategory)}}</p>


  </template>

  <script>
    Polymer({

      _o: function(o){
        return JSON.stringify( o );
      },

      is: 'pp-app',

    });
  </script>

</dom-module>

And also bower install PolymerElements/app-route.

If you navigate the links in order, and then back in reverse order, everything works file:

Root -> Page -> Perth -> Cat1 and then backwards Perth -> Page -> Root

HOWEVER, if you go to Root -> Page -> Perth -> Cat1, and then straight to page, you will see:

activeCategory and routeDataCategory: true {"category":"cat1"}

This tells me that the category route is, according to app-route, still active. However, it really really isn't.
I realise that there are some optimisation issues that will prevent routes from replicating. However, active really should reflect the truth. I looked through the code and couldn't work out why this is happening.

@mercmobily mercmobily changed the title Active is true when it _really_ should be in this super-simple use case Active is true when it _really_ should not be (super-simple use case) Nov 15, 2016
@TimvdLippe
Copy link

This should be fixed in #125

@OvermindDL1
Copy link

Same issue, #125 is not yet merged so this issue still exists.

@e111077
Copy link
Contributor

e111077 commented Apr 17, 2018

See explanation on #176.

Keeping this issue open for visibility

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants