Comments (4)
Hi @TommyVisic,
unfortunately I was not able reproduce the described behaviour. Could you please send an example project where the bug happens? I would be really interested looking into that behaviour.
Setting the onConsumed as a reference or as a lambda definately makes a difference in terms of recomposition. But the library needs to be save to use even with a lambda I think.
Btw: Was the code snippet above just a random example? I think you dont need to trigger this close event via the views state if it is just a direct reaction to a users button click.
from compose-state-events.
Here's a sample that reproduces the double event. It looks like the key is 1) observe a MutableStateFlow and 2) call navController.popBackstack in the StateEvent action.
Yes, this is pretty much a random example. But in our case, we do indeed involve the view model in the close event because we have to do some work before we want to actually close the screen. Basically it's a "save and close" kind of action.
Thanks for your response!
from compose-state-events.
@TommyVisic Thank your for your example project. I was able to reproduce your described behaviour. Looking into it.
from compose-state-events.
Fixed in release 2.2.0
from compose-state-events.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compose-state-events.