Fix the caching of the facet filter widget

#6138 

This also incorporates the fixes from #6059 which are required