like maximum-age or high-accuracy every initial request ignores those attributes;
The Guard placed in fetch method is not sufficient to ensure the element is ready:
fetch: function () {
// Guard clause in case observer runs before element is ready. Refer to Polymer issue #3438
// https://github.com/Polymer/polymer/issues/3438
if (this.idle === undefined || this.watchPos === undefined) {
return;
}
The fetch method (observer) is called twice - for each default value of this.idle and this.watchPos
but when this.idle and this.watchPos are set - the element is still not ready and none of the attributes are available , and fetch is executed with options like:
This causes maximum-age to not cache the location the first time, the first location is not accurate since the high-accuracy is not true and all sorts of problems on mobile device as well as performance issues.
A simple fix that is working for me is to add the 3 attributes to the list like so:
When having attributes like so:
like maximum-age or high-accuracy every initial request ignores those attributes;
The Guard placed in fetch method is not sufficient to ensure the element is ready:
The fetch method (observer) is called twice - for each default value of this.idle and this.watchPos
but when this.idle and this.watchPos are set - the element is still not ready and none of the attributes are available , and fetch is executed with options like:
This causes maximum-age to not cache the location the first time, the first location is not accurate since the high-accuracy is not true and all sorts of problems on mobile device as well as performance issues.
A simple fix that is working for me is to add the 3 attributes to the list like so: