At the moment, when the app starts, getUserData() is called through mounted(). This calls getUsername, getBio, etc. These are where the problem is.
If one of these functions return undefined (as oposed to an empty object (with key: "whatever" tho)), it will create the default data (eg db.user.put({ key: 'username', value: 'Newbie' }); and call getUserData() again ― even if it's the only one that would've returned undefined out of the getWhatever functions.
It's something that would only affect the first time an user opens the app, but still bothers me.
At the moment, when the app starts,
getUserData()
is called throughmounted()
. This calls getUsername, getBio, etc. These are where the problem is.If one of these functions return
undefined
(as oposed to an empty object (withkey: "whatever"
tho)), it will create the default data (egdb.user.put({ key: 'username', value: 'Newbie' });
and callgetUserData()
again ― even if it's the only one that would've returned undefined out of thegetWhatever
functions.It's something that would only affect the first time an user opens the app, but still bothers me.