[go: nahoru, domu]

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

Immutable Collection prevent composition many times even if required #306

Open
pseudoankit opened this issue Apr 14, 2023 · 6 comments
Open
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@pseudoankit
Copy link
pseudoankit commented Apr 14, 2023

I need to draw polylines
if I pass List<LatLng> it's fine but recomposing unnecessarily

Screen.Recording.2023-04-14.at.10.13.24.AM.mov

if I pass `ImmutableList` it's skipping composition even if required many times
Screen.Recording.2023-04-14.at.10.18.57.AM.1.mov
@pseudoankit pseudoankit added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Apr 14, 2023
@wangela
Copy link
Member
wangela commented Apr 14, 2023

If you would like to upvote the priority of this issue, please comment below or react with 👍 so we can see what is popular when we triage.

@pseudoankit Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

@pseudoankit
Copy link
Author

Update : Even if we mark data class with @Stable then also many times it skips composition

@pseudoankit
Copy link
Author

Update 2: got some workaround
wrapping the compose method with key block and providing the list as key seems to work
when using ImmutableCollection

data class Polyline(val latLngs : ImmutableList<LatLng>)
val mapPolylineList = persistentListOf<Polyline>()
key(mapPolylineList) {
    PlotPolyline(mapPolyline = mapPolylineList)
}

@GaneshShetty951
Copy link

Update 2: got some workaround wrapping the compose method with key block and providing the list as key seems to work when using ImmutableCollection

data class Polyline(val latLngs : ImmutableList<LatLng>)
val mapPolylineList = persistentListOf<Polyline>()
key(mapPolylineList) {
    PlotPolyline(mapPolyline = mapPolylineList)
}

Any explanation on how this works ??

@pseudoankit
Copy link
Author
pseudoankit commented Jul 5, 2023

@GaneshShetty951 it's does exactly same how having parms in composable works
but for some reasons composable annotated with @GoogeMapsCompose was not behaving correctly
so key block also does the same if value changes then only it will recompose it's block

@kikoso kikoso added priority: p3 Desirable enhancement or fix. May not be included in next release. and removed triage me I really want to be triaged. labels Jul 10, 2023
@mosmb
Copy link
Contributor
mosmb commented Aug 29, 2023

Exact same behavior with Marker.
Using ImmutableCollection does not trigger a recomposition of Marker which causes some markers to not appear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants