Giter VIP home page Giter VIP logo

Comments (6)

DevSrSouza avatar DevSrSouza commented on July 21, 2024

I will have to take a look on this. We have a popUtil function, we could have a replaceUntil as well, this would combine multiples pops and the push at the same time.

from voyager.

DevSrSouza avatar DevSrSouza commented on July 21, 2024

The way that Voyager disposes the Screens and ViewModel/ScreenModel is the next tick of the composition when the event is a dispose event, when you do pop+ push at the same time, the last event will be a push, so voyager can't dispose the screen that you have done pop. This is the nature of the library being built fully with Compose.

We have introduce a new way of handling disposing for Transition API that is still experimental, it does not relay on the lastEvent, I have not tested, but maybe it could work with pop + push, can you have a look?
#436

The docs are here: https://voyager.adriel.cafe/transitions-api/
Is the disposeScreenAfterTransitionEnd = true

We are considering replace the StepDisposable with this approach if is stable enough.

from voyager.

projectdelta6 avatar projectdelta6 commented on July 21, 2024

I tried upgrading to 1.1.0-beta02 and using disposeScreenAfterTransitionEnd = true as you suggested but I am now getting the Screen was used multiple times crash mentioned in the docs when I use either pop + push or just replace when navigating from ScreenB to ScreenC
I have tried setting a ScreenKey on the screen using the class name + data ID but I still get the crash... the error is Key ScreenC:{ID}:transition was used multiple times

from voyager.

DevSrSouza avatar DevSrSouza commented on July 21, 2024

Try to use uniqueScreenKey instead

from voyager.

projectdelta6 avatar projectdelta6 commented on July 21, 2024

ah I didn't realise uniqueScreenKey was an actual val...
So that stops the crash, but now it causes ScreenC's ScreenModel to be re-created in an infinite loop for some reason, I'm using replace to go from ScreenB to ScreenC
and I get the same using pop + push

from voyager.

projectdelta6 avatar projectdelta6 commented on July 21, 2024

ah I didn't realise uniqueScreenKey was an actual val... So that stops the crash, but now it causes ScreenC's ScreenModel to be re-created in an infinite loop for some reason, I'm using replace to go from ScreenB to ScreenC and I get the same using pop + push

I realised this issue was because I had the key as override val key: ScreenKey get() = uniqueScreenKey, so I changed it to override val key: ScreenKey = uniqueScreenKey and now using pop + push it appears to work with ScreenB's ScreenModel being disposed, though I do also see the log saying that ScreenC's ScreenModel was also disposed but ScreenC appears for now to be working. However if I use replace instead I do still get the Screen was used multiple times crash.

from voyager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.