Add getName to experimental ViewModelInstance API#463
Open
mfazekas wants to merge 1 commit into
Open
Conversation
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.
Summary
Adds
suspend fun ViewModelInstance.getName()to the experimental API, returning the editor-assigned instance name resolved by the command server.Consumers migrating from the classic API currently lose the instance name:
CommandQueueonly exposesgetViewModelInstanceNames(file, viewModelName)(the per-view-model name list), which cannot tell an existing instance which one it is. Instances created by name echo back what the caller already knew, while default, blank, nested (reference-path) and list-item instances have no way to learn their name at all.The command queue protocol has no message carrying an instance's own name (
getViewModelInstanceViewModelNamereturns the view model's name), so the binding resolves it withrunOnceon the command server thread viaCommandServer::getViewModelInstance()->name()and calls back into Kotlin from there — no runtime protocol change needed.Covered by unit tests and an instrumented test asserting parity with the classic API's
ViewModelInstance.namefor named, default, blank, nested and list-item instances againstdata_bind_test_impl.riv.The same gap exists in the rive-ios experimental API (RiveRuntime 6.20.4
ViewModelInstancehas no name member); the same design would apply there for parity.