Ionic.io.bundle.js exception on second run


#1

Hi there,

I’m seeing an app that uses Ionic Services failing to display anything on second load (after a user.save() call).

It looks like the exception is thrown when Ionic Services tries to initialize and deserialize UserData. Specifically the first line below evaluates as true. But as I can see from the interactive console that the object in question, this.data[x] (where x is “user_id”) is actually null. Therefore this.data[“user_data”].__Ionic_DataTypeSchema throws and the app halts execution at this point:

                            // do we have a custom type?
                            if (this.data[x].__Ionic_DataTypeSchema) {```

In short this is because `typeof (null === 'object')` is `true`.

If anyone has any ideas whether this is a bug, and if so how I can fix it I'll be very grateful.

Platform: Real iPhone 6, iOS 9, Ionic 1.1, Cordova iOS 3.9.1
No problems on desktop with ionic serve

<img src="/uploads/default/original/3X/a/c/ac2c6dea9dea0413fa4e98dfe157534bd62c9e16.png" width="690" height="236">

<img src="/uploads/default/original/3X/5/4/54e277351af0fb5c6ad8721717b58524644dfbdb.png" width="690" height="244">

#2

Further to this, it would appear that setting user.id (with a non-empty String) and calling user.save() is the cause of this. For some reason on iOS this is not populating the user_id property correctly on UserData.