I initialize a property on users with the following:
Moralis.Cloud.beforeSave(Moralis.User, (request) => {
if (!request.object.id) {
request.object.set('coins', 200);
}
});
And I later update this âcoinsâ property in a cloud function, which I see working in the Dashboardâs Browser. Currently my user has â60â coinsâŚ
On my frontend, Iâm doing currentUser.get('coins')
. This is always returning 200 on the initial page load. However, if I call a Cloud function that updates this value, calling .get('coins')
on the user will then return the correct amount.
Is there any reason you could think of that I would be getting a cached version of this property? I thought I might be overriding it, but the correct value shows up in the dashboard.