fix(android): port VMI dispose and Handler fixes to the legacy backend#333
Merged
mfazekas merged 2 commits intoJul 14, 2026
Merged
Conversation
…(legacy) Port of 6e55131 from android/src/main: lastKnownViewModelInstance survived dispose, so a JS caller still holding the view ref got the retained, already-released instance back (first property access throws "Cannot acquire a disposed object") instead of null. Clear it on the disposing detach, and resolve null from the main-thread read once willDispose is set so a refresh posted before dispose can't re-cache a released instance afterwards.
…hes (legacy) Port of 84e6d26 from android/src/main: the async hook's ref path polls getViewModelInstance() every 50ms; allocating a Handler per off-main call was avoidable churn.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ports 6e55131 and 84e6d26 from PR #331 (android/src/main) to the legacy copy of RiveReactNativeView.kt: clear the
lastKnownViewModelInstancesnapshot on the disposing detach and resolve null from the main-thread read oncewillDisposeis set, so post-dispose reads return null instead of a released instance; and reuse a cached main-thread Handler instead of allocating one per off-maingetViewModelInstance()call. The file is now byte-identical to main's fixed copy.