Replies: 1 comment 3 replies
-
Hi @kirillsh, the behavior you have demonstrated above is to be expected. By doing this: static var liveValue: Parent {
@Dependency(Child.self) var child
return Self(child: child)
} …you have decided to resolve the I'm not entirely sure what you are trying to accomplish in your real code. Perhaps you can share something more real world. But since this isn't an issue with the library I am going to convert it to a discussion, and please feel free to continue the conversation over there. |
Beta Was this translation helpful? Give feedback.
-
Description
In our project we're using dependencies that rely on other lower level dependencies. We're usually doing that by declaring
@Dependency(\.child)
property wrapper inside parent's implementation ofliveValue
.But because parent's value is cached upon its first resolution -> no matter how we override the child's value, the parent will not be recalculated capturing its child's initial value.
This might produce unexpected side effects like in the example below.
Checklist
main
branch of this package.Expected behavior
Parent.liveValue
is recalculated afterChild
is overwritten.Actual behavior
Parent.liveValue
is resolved from cache capturing the initialChild
value.Steps to reproduce
Dependencies version information
1.3.0
Destination operating system
iOS 17
Xcode version information
15.4
Beta Was this translation helpful? Give feedback.
All reactions