skiptools / skiptools/skip

Skip Fuse: State not updating correctly in view under NavigationLink

Open
#687 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
3.2k
Forks
106
Avg merge
6d 13h
Merged PRs (30d)
1

Description

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"!)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied ContentView reproduction in Skip Fuse and compare its NavigationLink behavior with iOS and Skip Lite. Trace the state update from the pushed view's task through the displayed Text. Done means the second screen displays "pushed" rather than "pending" while preserving the logged "pushedText: pushed" value.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.