Replies: 1 comment 1 reply
-
Hi @mobilne, I believe all of these changes were covered in the migration guide. First, the TCA migration guide for 1.17 mentions that if you want to maintain backwards compatibility with the version of sharing that existed in TCA prior to 1.17, you can pin to Swift Sharing 0.1.0. And then the Swift Sharing migration guide for 1.0 shows you how to upgrade to 1.x when you are ready.
Yes, this is a 1.0 change. If you do not want to change your keys to this you can pin explicitly on 0.1 in order to maintain backwards compatibility.
I am not able to reproduce this. Would you be able to create a simple, standalone test case that shows the behavior you are seeing?
This is also covered in the 1.0 migration guide here. Previously the publisher acted more like a passthrough subject, now it behaves like a current value subject. Again, you can pin to 0.1 if you don't want this behavior for the time being. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
after update on 1.17.0 and sharing lib 1.0.4 there are few changes I was forced to, like:
to:
and in the reducer
state.user = newUser
tostate.$user.withLock { $0 = newUser }
Tests:
Besides, some tests don't pass now, because direct assigning
@Shared(.user) var user = User(.Mocks.disabled)
does not put the desired value there, so I have to use withLock closure. But just in some tests.Also when subscribe on shared in reducer, like:
the test complains that I don't handle userChanged action that is caused by emitting value on subscription. Before the test did not take it into account.
Example:
This test now complaints on: API violation - multiple calls made to -[XCTestExpectation fulfill] for retrieveRemovedContacts. Because both .initializeCallLog and .userChanged actions use the dependency and .userChanged is called on shared user subscription.
Would you have any hint what I did wrong, in the past by using shared or now after update? The general question is why there is an emission of the action on shared state subscription and why the test did not reflect this before the update to 1.17.0, when sharing was part of the library...
Thanks.
Sincerely,
David.
Beta Was this translation helpful? Give feedback.
All reactions