Skip to content

fix(android): avoid redundant image reloads - #442

Merged
duguyihou merged 2 commits into
duguyihou:mainfrom
noma4i:fix/android-skip-unchanged-image-reload
Jul 22, 2026
Merged

fix(android): avoid redundant image reloads#442
duguyihou merged 2 commits into
duguyihou:mainfrom
noma4i:fix/android-skip-unchanged-image-reload

Conversation

@noma4i

@noma4i noma4i commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Avoid scheduling another Android image request when the effective image configuration is unchanged and the previous request already completed successfully.

Repeated React updates and view transactions should not reload an image when its source, headers, cache policy, placeholders, transformations, and layout inputs are unchanged.

Changes

  • Build a signature from the effective Android image request configuration.
  • Track the active and last successfully loaded signatures in TurboImageView.
  • Skip a normal reload when it matches the successful signature.
  • Keep lifecycle reloads explicit: resume forces one request, while pause and teardown clear the tracked state.
  • Disable Coil's network observer so the view manager owns reload decisions.

Directly addresses the same problem I have seen here #440

@noma4i

noma4i commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

In case of this is the extract from our production app in Playstore.

@duguyihou
duguyihou merged commit 1219729 into duguyihou:main Jul 22, 2026
7 checks passed
duguyihou added a commit to tss-ashishmishra/react-native-turbo-image that referenced this pull request Jul 23, 2026
Reconciles this branch's shared-OkHttpClient/ImageLoader fix (duguyihou#440) with
main's independently-merged duguyihou#442, which added networkObserverEnabled(false)
and load-signature skip-reload logic touching the same reloadImage()/
onDropViewInstance() code.

Keeps both fixes: main's networkObserverEnabled(false) is carried onto the
shared ImageLoader as defense-in-depth (it already disables the
ConnectivityManager callback directly), while this branch's loader/client
sharing still fixes the connection-pooling and memory-bloat half of duguyihou#440
that networkObserverEnabled(false) alone didn't address. Skip-reload
signature tracking and progress-listener registration coexist unchanged.
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.

2 participants