Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable refetching broken image on source change #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bradstiff
Copy link

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.

@bradstiff
Copy link
Author

bradstiff commented Nov 21, 2024

Fixes #25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant