react-native-web icon indicating copy to clipboard operation
react-native-web copied to clipboard

Fix Image Caching

Open kidroca opened this issue 2 years ago • 6 comments

Description

This PR fixes some subtle inconsistencies around image caching and rendering the same image multiple times

Fixes #2492

Test Strategy

Created a sandbox sample from the pull request, where the bug can no longer happens https://codesandbox.io/s/rnw-image-flicker-bug-fix-s93ri0

Steps:

  1. Go to https://codesandbox.io/s/rnw-image-flicker-bug-fix-s93ri0
  2. Press the "Add More" button at the top a few time
  3. Images are no longer flickering

Why No Unit Tests

Couldn't easily add unit tests for this change, because the main change is to the ImageLoader.load which doesn't have a test suit, and is mocked in the Image tests

Existing tests cover the changes in the Image component

kidroca avatar Mar 03 '23 11:03 kidroca

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 192947497fc2fbb352b0aa6db3e3649c92aae7b9:

Sandbox Source
react-native-web-examples Configuration
RNW-image-flicker-bug-fix PR
RNW-image-flicker-bug-fix PR
RNW-image-flicker-bug-sample Issue #2492

codesandbox-ci[bot] avatar Mar 03 '23 11:03 codesandbox-ci[bot]

BTW This PR also fixes Image.queryCache - I don't think we have an issue for this, but right now Image.queryCache does not work as intended (nothing already loaded is considered cached) @necolas do you want me to open an issue for tracking purposes?

kidroca avatar Mar 22 '23 16:03 kidroca

Hi, please could you rebase this. Now that 0.19 is done, the 0.20 release will be focused on Image changes.

necolas avatar Mar 29 '23 18:03 necolas

✅ rebased

kidroca avatar Apr 04 '23 07:04 kidroca

One unit test snapshot is failing

necolas avatar Apr 05 '23 17:04 necolas

One unit test snapshot is failing

Sorry, should be fine now

kidroca avatar Apr 06 '23 16:04 kidroca