You will get this notice when you try to load the user from the store like this
api.container.lookup('service:store').find('user', api.getCurrentUser().username).then((user) => {
});
Hydrating the user form the store apparently access the timezone on the user, triggering this notice.
I use the above code to access the user’s user_fields which are not populated on the user returned by api.getCurrentUser().
Is there a different way to get the user_fields from a theme or theme component without the above construction?
I found a away around getting this deprecation notice, and still getting access to the user_field:
api.getCurrentUser().findDetails().then((user) => { ... });
However, findDetails will always send a request to the server. Nothing is cached. Once it is called, the current user will have a populated user_fields.
So you can optimize the logic a bit like:
function withUserFields(user, callback) {
if (user.user_fields === undefined) {
user.findDetails().then(callback);
} else {
callback(user);
}
}
withUserFields(api.getCurrentUser(), (user) => {
// do something with user.user_fields[]
});