pointfreeco / swift-composable-architecture

A library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind.
https://www.pointfree.co/collections/composable-architecture
MIT License
12.35k stars 1.44k forks source link

Perception warnings in State.init #3402

Closed KirillZholnerovich closed 4 weeks ago

KirillZholnerovich commented 4 weeks ago

Description

For example, we have ParentFeature and ChildFeature and if we have array of ChileFeature.State in ParentFeature.State it throws runtime perception warning

Code:

@Reducer
 public struct ParentFeature {
    @ObservableState
    public struct State {
        public var items: IdentifiedArrayOf<ChildFeature.State> = [ .init() ]

        //...
    }

    //.......
 }

Checklist

Expected behavior

No perception warnings

Actual behavior

Have perception warnings

Reproducing project

No response

The Composable Architecture version information

1.15.0

Destination operating system

iOS 18.0

Xcode version information

Xcode 16.0

Swift Compiler version information

swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx15.0
stephencelis commented 4 weeks ago

@KirillZholnerovich I don't think this is a bug in the library and you have not provided a full reproduction for us to evaluate the problem.

It does sound like maybe there could be an observation issue in your application requiring a WithPerceptionTracking view, but we'll need more info to help. Please follow up in the discussion with some compiling sample code!