App-location removes query string parameters

I have a very simple polymer 2 application that uses string query parameters. Moving to Polymer 2.0.1 and app-location 2.0 (instead of rc and previews), I noticed that simply having the app-location element removes all query string parameters from the URL.

Try this url: https://api-1913.s3-eu-west-1.amazonaws.com/index.html?foo=bar and notice how the query string is removed at load time.

Here's all the code: index.html:

<!DOCTYPE HTML>
<script src="/bower_components/webcomponentsjs/webcomponents-loader.js"></script>
<link rel="import" href="/my-app.html">
<html>
  <head>
  </head>
  <body>
    <my-app></my-app>
  </body>
</html>

      

my-app.html:

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

<dom-module id="my-app">
  <template>
    <app-location></app-location>

    <h1>Coin</h1>
  </template>
  <script>
    class App extends Polymer.Element{
      static get is(){return 'my-app'}

      ready(){
        super.ready()
        console.log('ready')
      }
    }
    customElements.define(App.is, App)
  </script>
</dom-module>

      

Specifying an attribute query-params

to map it to a property App

does not change anything. Remove the item app-location

and the query string is preserved.
Has anyone seen this behavior? Is there a workaround - other than rolling back to a previous version?

+3


source to share


1 answer


This is mistake. You can temporarily remove the default in the iron location item until a fix is โ€‹โ€‹released.

Removal lines

value: function() {
  return {};
}

      



Affected property

   paramsObject: {
    type: Object,
    notify: true,
    value: function() {
      return {};
    }  
   },

      

Link: https://github.com/PolymerElements/iron-location/pull/86/commits/3732e93ce2197178f76c3c2073438b9cd15096b4

0


source







All Articles