pointfreeco/swift-composable-architecture

Extra Perception Warning

Closed this issue · 1 comments

Description

Show unnecessary perception tracking runtime warning. You can check that I capture all store accesses.
Снимок экрана 2024-05-10 в 13 56 06

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

Not show warning

Actual behavior

Show warning

Steps to reproduce

  1. Run
  2. Tap on "Tap" button
  3. You see runtime warning
    BadPerceptibleWarning.zip

The Composable Architecture version information

1.10.3

Destination operating system

iOS 17.4.1

Xcode version information

15.3

Swift Compiler version information

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)

Hi @nmalevich, the problem is in ActivityIndicatorView. If you comment that out you will see it works. And the reason there is a problem is because ActivityIndicatorView takes a binding and it accesses the state in its body, and of course there is no WithPerceptionTracking over there.

Really it's not clear why ActivityIndicatorView even takes a binding. It never writes to the binding. It would be better if it took a simple Bool, and then you would not have this problem.

Since this is not an issue with the library I am going to convert it to a discussion. Feel free to continue the conversation over there.