WIP: Add caching to widgets.

#6043 
Replacing #6188 PR
WIP