PolymerElements / app-route

A modular client-side router
https://www.polymer-project.org/1.0/articles/routing.html
146 stars 66 forks source link

Error when using `auto-activate` when routing from activated path to rootPath #230

Closed andrewspy closed 6 years ago

andrewspy commented 6 years ago

Description

When routing from activated path (i.e. /admin, which activated to /admin/) to rootPath (i.e. /). encounter error in Chrome.

From the console of Firefox, it seems to suggest that the URL becomes // which is an invalid URL and caused the error.

Expected outcome

No error

Actual outcome

In Chrome

Uncaught TypeError: Failed to construct 'URL': Invalid URL
    at resolveURL (iron-location.html:79)
    at HTMLElement._updateUrl (iron-location.html:265)
    at Object.runMethodEffect [as fn] (property-effects.html:818)
    at runEffectsForProperty (property-effects.html:162)
    at runEffects (property-effects.html:128)
    at HTMLElement._propertiesChanged (property-effects.html:1711)
    at HTMLElement._flushProperties (properties-changed.html:341)
    at HTMLElement._flushProperties (property-effects.html:1559)
    at HTMLElement.__enableOrFlushClients (property-effects.html:1604)
    at HTMLElement._flushClients (property-effects.html:1579)

Live Demo

N/A

Steps to reproduce

// app-route is set to auto-activate and will change path to '/admin/'
this.set('route.path', '/admin');
this.set('route.path', '/');

Browsers Affected

andrewspy commented 6 years ago

Closing the issue as I have discovered it was an issue on my app where I use multiple subroute which was all activated at the same time.