android / android/nowinandroid
[Bug]: SearchRoute recomposing twice despite no state change ?
- Dominant language
- Kotlin
- Stars
- 21.8k
- Forks
- 4.6k
- Avg merge
- 19h 20m
- Merged PRs (30d)
- 2
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Is there a StackOverflow question about this issue?
- [X] I have searched StackOverflow
### What happened?
I am not sure if this is a bug or not but as per basic Compose tenets , a composable will NOT recompose if its state remains unchanged from the first time it was composed .
I have attached a breakpoint and confirmed that when SearchRoute recomposes , none of its arguments have changed.
I am aware that this composable's callsite does gets recomposed multiple times , but I am unsure as to why does this cause its child composable (SearchRoute) to recompose .
This is strange specially because we are not passing unstable lambdas in SearchRoute , rather are relying on method references (which correctly remain the same upon recomposition).
Take a look at both these screenshots , and observe all references are similar. One screenshot was taken on first time around , and the second is of the recomposition


### Relevant logcat output
_No response_
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Reproduce the report in the app with a breakpoint in SearchRoute and observe the callsite's repeated recompositions. Compare SearchRoute's arguments and method references across runs, then determine whether the observed recomposition is expected; done means the cause is documented or a narrowly scoped fix is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100