How to avoid caching of fields in Entity View? I have a few computed fields on my entity and they have dynamic values. These values cannot be cached because they change often.

I've created the necessary field formatter that uses the same approach that the comment module uses to display the uncached comment form by using the #post_cache_render callback.

This I found does not always work(the value is sometimes displayed in one view mode but not in another).

The other issue I have is that if the value is empty, the field label is still visible because it is not part of the formatter and therefore it is cached with the rest of the Entity View data.

So my question is: how can I use fields with dynamic values so they won't get cached in the Entity View?

I've also tried all hooks that allow adding or changing data in the Entity View but every single one get's cached and so I found it impossible to avoid the cache.
You can not do it per field, that would defeat the purpose. The whole entity is cached.

You can disable render caching for your entity by setting render_cache = FALSE in your annotion and you can do it per view mode.