Since Magnolia 5.4 (after 5.3 m10) the thumbnail layout is not refreshed properly anymore when the datasource is changed.
The change in
MGNLUI-3373 http://git.magnolia-cms.com/gitweb/?p=magnolia_ui.pub.git;a=commit;h=3183aa0b981bb48aadf6fd48686ea676d662a3db introduces a new "EscalatorThumbnailsPanel" implementation which only initializes the client side panel when the widget is built. The amount of thumbnails is never refreshed and cached thumbnails are not changed even if the item changes in the datasource.
This change totally broke our UIs based on the previous ThumbnailContainer, which should have been compatible with the new implementation. The worst thing is that at the moment it seems there is no way to force a refresh, even calling refresh() in LazyThumbnailLayout or clearing the cache in LazyThumbnailLayoutConnector is not useful at all.
For example if you use the thumbnail container to display the content of a specific folder, updating the datasource (selecting a different folder) without destroying/recreating the panel this is what happens:
- if you display the content of a folder containing 2 images and then switch to another one which contains 4 images the panel will still display 2 images only (LazyThumbnailLayoutConnector.refreshViewport() called, but cache is not refreshed and the number of html elements not recalculated)
- if you display the content of a folder containing 4 images and then switch to another one which contains 2 images only the panel will still show 4 images and only the first two will be refreshed (LazyThumbnailLayoutConnector.refreshViewport() called, but cache is not refreshed and the number of html elements not recalculated)
- if you display a folder containing 2 images and switch to another folder containing 2 images nothing happens (refreshViewport() is not even called since the number of items is not changed)
If not updating automatically there should be at least a way to force a real refresh of the content, however I am not sure what kind of event/notification would be better to use here.
As a partial patch we fixed it by reinitializing the panel when the "thumbnailAmount" property changes in LazyThumbnailLayoutConnector, however this is not perfect because it only fixes 1) and 2) but doesn't help when the datasource is refreshed without changing the total number of items.
This is really a blocker for us for properly upgrading to magnolia 5.4, and also patching the widgeset is a real pain...
It would be great to have at least the attached patch included for magnolia 5.4.2, and if somebody could review the LazyThumbnailLayout implementation in order to properly react even if the number of items is not changed.