Is really a "Current User" object stored in Page Data needed anylonger?

I see from quite a lot of examples that a Current User context is stored either in Page Data or App Data. However, I am wondering if that is really needed, with the User API functions Get Current User Token and Get current user:

I know it does not do any harm in itself, but isnt it just another copy of the same data? Or am I missing something?

I would like to simplify my code if needed, so what I am looking at is to remove my use of a separate Current User context in App Data if Backendless always handles this behind the curtains anyway.

I know that if you tick of “reload”, you will do a database transaction, but if the rest is handled automatically, then I guess that is code saved…

Hi @Egil_Helland

Well, it depends on your design.
When you put anything into a DataModel (AppData/PageData/etc) you convert it into a reactive data store and each time when you change any property inside it provokes a re-render of UI which is placed under the DataModel.

It means changing AppData.currentUser.name = “new name” re-renders the entire app.

But if you use the “Get Current User” in a LogicHander and then set/save a new value to the “Get Current User” it won’t trigger a new re-render and the LogicHander won’t run and you won’t see these changes in the UI

Regards,
Vlad

Yup yup, that makes perfect sense. Thanks for deliberating!