Skip to content

AsyncButton action uses the initial view value #23

Closed

Description

@alexmomotiuk

Thanks for ButtonKit, it’s a really useful library.

I encountered unexpected behavior when a value passed into a child view changes. The UI displays the updated value, but AsyncButton still uses the value captured during its initial render.

struct ContentView: View {
    @State private var value = 0

    var body: some View {
        VStack {
            Button("Increment") { value += 1 }
            Text("Value: \(value)")
            ChildView(value: value)
        }
    }
}

struct ChildView: View {
    let value: Int

    var body: some View {
        AsyncButton {
            print("Value:", value)
        } label: {
            Text("Print")
        }
    }
}

Steps:

  1. Tap Increment. The displayed value becomes 1.
  2. Tap Print.

Expected: Value: 1
Actual: Value: 0

Is this intended behavior?

Activity

  1. Dean151 commented on Aug 5, 2026

    @Dean151
    Owner

    Hi!
    Thanks for reaching out.
    This was not the intended behavior, thanks for reporting it!
    I've published a fix in 0.8.1 for this

  2. added 2 commits that reference this issue on Aug 13, 2026
    d7bb672
    8ea442e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions