FFImageLoading icon indicating copy to clipboard operation
FFImageLoading copied to clipboard

CacheKeyFactory used in a CollectionView causes incorrect images to load.

Open AdamEssenmacher opened this issue 3 years ago • 0 comments

🐛 Bug Report

Using a CacheKeyFactory on images rendering inside a CollectionVIew (or other collection using recycling / virtualization) can cause incorrect images to load.

Expected behavior

Correct images always load when using a CacheKeyFactory

Reproduction steps

Use a CacheKeyFactory within a CollectionView's DataTemplate like:

                <CollectionView ItemsSource="{Binding Items}">
                    <CollectionView.ItemTemplate>
                        <DataTemplate x:DataType="viewModels:MyViewModel">
                            <ffimage:CachedImage Source="{Binding ImageUrl}">
                                <ffimage:CachedImage.CacheKeyFactory>
                                    <ui:MyCacheKeyFactory />
                                </ffimage:CachedImage.CacheKeyFactory>
                            </ffimage:CachedImage>
                        </DataTemplate>
                    </CollectionView.ItemTemplate>
                </CollectionView>

Load the collection up with enough items (with unique images) to require scrolling. Scroll and you should notice that sometimes an incorrect image is displayed.

I saw this using Xamarin.Forms on iOS. Not sure about Android.

Configuration

Version: 2.4.11.982

Platform:

  • [ x] :iphone: iOS
  • [ ?] :robot: Android
  • [ ?] :checkered_flag: WPF
  • [ ?] :earth_americas: UWP
  • [ ?] :apple: MacOS
  • [ ?] :tv: tvOS
  • [ x] :monkey: Xamarin.Forms

AdamEssenmacher avatar Mar 17 '22 21:03 AdamEssenmacher