react-native-web
react-native-web copied to clipboard
Fix Image Caching
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:
- Go to https://codesandbox.io/s/rnw-image-flicker-bug-fix-s93ri0
- Press the "Add More" button at the top a few time
- 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
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 |
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?
Hi, please could you rebase this. Now that 0.19 is done, the 0.20 release will be focused on Image changes.
✅ rebased
One unit test snapshot is failing
One unit test snapshot is failing
Sorry, should be fine now