-
Notifications
You must be signed in to change notification settings - Fork 143
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
chore: Change the confusing parameter
position to a clear name. #637
#638
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
7c63b15
to
34a1a7d
Compare
parameter
position to a clear name. #637parameter
position to a clear name. #637
I resolved the conflict. |
Hi @JSpiner . This is a reasonable proposal. Typically we would like to not drop a breaking change, but to propose a transition time for folks to change. I think we could offer an alternative constructor to the current one, deprecate the former and leave folks one version to upgrade to the new one. We could eventually pack this PR with another breaking change. |
*/ | ||
@StateFactoryMarker | ||
public operator fun invoke( | ||
position: LatLng = LatLng(0.0, 0.0) | ||
): MarkerState = MarkerState(position) | ||
initialPosition: LatLng = LatLng(0.0, 0.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the rationale for changing the parameter name here. Makes sense for rememberMarkerState, but not here. If you end up recomposing MarkerState.invoke(position) you will get a new MarkerState object.
It may look tempting because of the "initial marker position" KDoc verbiage, but that's how State objects generally work, including MutableState. It's mutableStateOf(value="bla")
.
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #637 🦕
It may be confusing that it is automatically updated by the
position
parameter. I renamed it toinitialPosition
to make it clear that it only works with the initial value.(The compose foundation libraries also add the init prefix to the initial values that go into rememberXXX.)