GoogleWebComponents / firebase-element

Web components for the Firebase Web API
https://elements.polymer-project.org/elements/firebase-element
95 stars 72 forks source link

autoLogin not reflecting value of attribute? #98

Closed mm-gmbd closed 8 years ago

mm-gmbd commented 8 years ago

In the example included with firebase-element, I added the attribute autoLogin to firebase-auth to test its functionality, but it always prints as false, regardless of the value I set it to.

<firebase-auth
      id="firebaseLogin"
      user="{{user}}"
      status-known="{{statusKnown}}"
      location="{{location}}"
      autoLogin=true //true, "true", or anything else make no difference
      provider="custom"
      on-error="errorHandler"
      on-user-created="userSuccessHandler"
      on-password-changed="userSuccessHandler"
      on-password-reset="userSuccessHandler"
      on-user-removed="userSuccessHandler">
    </firebase-auth>

I added a log to _authHandler to check the value of autoLogin, but it always prints false:

    _authHandler: function(user) {
      console.log('this.statusKnown: '+this.statusKnown)
      console.log('this.autoLogin: '+this.autoLogin)
    ...
    }

   > this.statusKnown: false
   > this.autoLogin: false

I thought this may be because of the reflectToAttribute element being true:

/**
* When true, login will be attempted if login status check determines no user is
* logged in.  Should generally only be used with provider types that do not present
* a login UI, such as 'anonymous'.
*/
autoLogin: {
  type: Boolean,
  value: false,
  reflectToAttribute: true //false or removing entirely has no effect
},

So, I set reflectToAttribute to false and removed it entirely with no change in behavior. The only thing that actually changes the output is setting the autoLogin.value: true in the firebase-auth element, and I don't think changing the element itself is how things are supposed to work.

I'm new to Polymer, so I'm guessing its a quick fix, but I don't know what it is...

mm-gmbd commented 8 years ago

autoLogin attribute needed to be auto-login... whoops.