Skip to content

Skip Fuse: State not updating correctly in view under NavigationLink #687

@dfabulich

Description

@dfabulich

To repro: Run this in Skip Fuse. Launch the app, and tap the "Push" NavigationLink

import SwiftUI

struct ContentView: View {
    @State var rootText = "pending"
    @State var pushedText = "pending"

    var body: some View {
        NavigationStack {
            VStack(spacing: 16) {
                Text(rootText)
                NavigationLink("Push") {
                    let _ = logger.debug("pushedText: \(pushedText)")
                    Text(pushedText)
                        .task { pushedText = "pushed" }
                }
            }
            .task { rootText = "root" }
        }
    }
}

Expected: On iOS and Skip Lite, the first screen says "root", and the second screen says "pushed"

Actual: The first screen says "root", but the second screen says "pending". (And yet, if you check the logs, it says "pushedText: pushed"!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions