You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
There was a very weird behavior about HTML history after I have converted to Polymer 1.0. I have come a long way down to replace and intercept the history.pushState call and the cause seems that more-routing does a push.
After I do load a page, the library pushes a history which seems to be identical to the actual page. So after I load a page I am able to click the back button and apparently nothing changes. Why is more-routing doing this? In more complex situations it completely messes the history.
I guess it all comes down to line 39 in route.html
varparams=MoreRouting.Params(namedParams(this.compiled),this.parent&&this.parent.params);params.__subscribe(this._navigateToParams.bind(this));// <--- this line, commenting it seems to fix the problemObject.defineProperty(this,'params',{get: function(){returnparams;},set: function(){thrownewError('Route#params cannot be overwritten');},});
I don't know the internals enough to say what this line is needed for but apparently it doesn't do its job very well.
__subscribe says that:
/** * Registers a callback that will be called each time any parameter managed by * this object (or its parents) have changed. * * @param {!Function} callback * @return {{close: function()}} */
__subscribe: {
So why are we automatically calling navigate when parameters managed by a <more-route context ...> changes? Do I need to do a two-way binding and change the parameter inside the polymer component so that it will propagate the change to more-route's params attribute? And then more-route will do a history.pushState with the resolved URL? How will that work if the URL has some static parts that cannot be changed with a variable anyway?
Well it still doesn't explain the history.pushState call on a fresh page load. It has a one-way binding so more-route shouldn't even see a change on parameters:
Please note that I recently had started using more-route elements with context attribute after upgrading to Polymer 1.0 after which this problem started.
There was a very weird behavior about HTML history after I have converted to Polymer 1.0. I have come a long way down to replace and intercept the history.pushState call and the cause seems that more-routing does a push.
After I do load a page, the library pushes a history which seems to be identical to the actual page. So after I load a page I am able to click the back button and apparently nothing changes. Why is more-routing doing this? In more complex situations it completely messes the history.
Here is the call path on a fresh page load:
If I use
MoreRouting.navigateTo
, this happens:First:
Second:
As you can see there is still a duplicate pushing.
P.S.
Obviously, I am using the html5 history driver.
I started using
<more-route context ...>
(emphasis on context) after the upgrade to Polymer 1.0.The text was updated successfully, but these errors were encountered: