Giter Club home page Giter Club logo

Comments (3)

koraykoska avatar koraykoska commented on May 29, 2024 2

So since using navigator.navigate instead of rendering a Navigate, this error doesn't happen anymore. Still a little annoying but it is a good hack at least.

from swiftui-router.

koraykoska avatar koraykoska commented on May 29, 2024

Oh, forgot to mention it. Once the app is in this state, it does that all the time. So e.g. in this example the default route should go back to "/home/root" but instead, again, navigates to /home fallback (endless loop). That's why I don't even fallback but rather go to an empty screen because of SwiftUI's optimizations.

from swiftui-router.

frzi avatar frzi commented on May 29, 2024

Hmm it's very possible you're talking about a bug I've encountered very rarely - like only three times in total. Unfortunately so far I have been unable to successfully (and consistently) reproduce it.

The one time I did caught it, however, it looked like - for whatever reason - SwiftUI decided to render the children of SwitchRoutes in reverse order. Like some weird magic optimization SwiftUI decided to perform out of nowhere. Meaning the last route would render (and perform path matching) first, instead of last. Thus resulting in the behaviour you described.

My gut tells me this is some optimization introduced in SwiftUI 3, as I don't recall experiencing this bug in SwiftUI 2. But it's hard to tell.

It is certainly worrying, and I really hope to find a method/routine to reproduce this bug consistently to further investigate it. Any help on this matter would be greatly appreciated!

So far from the top of my head potential solutions could be making a custom ViewBuilder for SwitchRoutes (lord have mercy), or work with .id() for Routes views (yuck). 😞

from swiftui-router.

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.