Enable refetching broken image on source change #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables the component to refetch the image on a new source object prop, even if the component's error state value is set.
I removed the error state value from the dependencies of the effect that fetches the image. I also removed the logic that returns early from the effect when error is set.
I removed the logic that recreates the source object prop, as that value is a dependency of the effect that fetches the image. We need it to be stable, otherwise the component fetches the image over and over when an error occurs.
I removed the logic that directly edits source.hybridAssets in the interest of prop immutability. In the renderImageContent function, I spread the source object into a validatedSource object, and force hybridAssets to be true only when cloudUrl has a value.
Unfortunately, there is a lot of whitespace formatting changes that will make the PR hard to read.