Ember Uncaught Error: Attempted to handle event `didSetProperty`

Total
1
Shares

I am getting this error and it seems to be when I destroy the session on my “auth” logic. I have read everything I can find and it seems to be something to do with the values of the object that is being destroyed, but I’ve tried everything I have found and no luck. If anyone could point me in the right direction to a solution I would greatly appreciate it.

Error

Uncaught Error: Attempted to handle event didSetProperty on while in state root.deleted.saved. Called with {name: email, oldValue: undefined, originalValue: undefined, value: [email protected]}.

Controller

App.ApplicationController = Ember.ObjectController.extend
  actions:
    signOut: ->
      @get('model').destroyRecord().then =>
        $.removeCookie 'apiKey'
        @set 'model', @store.createRecord 'session'
        @transitionToRoute 'sign-in'
      , ->
        @transitionToRoute 'sign-in'

Route

App.ApplicationRoute = Ember.Route.extend
  model: ->
    if !$.cookie 'apiKey'
      @store.createRecord 'session'
    else
      @store.find('session', 'current').then (session)->
        session

Session Model

App.Session = DS.Model.extend
  access_token: DS.attr()
  email: DS.attr()
  password: DS.attr()
  isLoggedIn: Ember.computed.notEmpty 'access_token'
  user: DS.belongsTo 'user', embedded: 'always'

App.SessionSerializer = DS.ActiveModelSerializer.extend DS.EmbeddedRecordsMixin,
  attrs: user: embedded: 'always'

Solution

This is a bit late, sorry.

When the promise to destroy the model is resolved, something is being set on the model – session record in this case. Please note the @get('model').destroyRecord() command is followed by the @set 'model' command.

That is why the error message has while in state root.deleted.saved.

Leave a Reply

Your email address will not be published. Required fields are marked *