Using '.run' and 'await in' to observe AnyPublisher<Value, Never> does not work #1922
Replies: 1 comment 12 replies
-
Hey @SebastianBoldt! If |
Beta Was this translation helpful? Give feedback.
-
Hey @SebastianBoldt! If |
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.
-
Hey,
I currently do have some Issues related to long living effects.
To give you some background:
I created a Dependency to observe a specific value from the UserDefaults.
It returns an AnyPublisher we can subscribe to, to get notified when the value changes.
Inside the reducer I observed the value changes using eraseToEffect:
it works like a charm but after I took a look into the Docs I discovered that it is recommended to use
.run
andfor await value in sequence
for that. So I tried to do that.But unfortunately I doesn't work as expected.
It will get triggered once, but each time I change the value in the User-Defaults the action will not get send.
I first assumed that my publisher was cancelled or completed somehow under the hood so I tried to investigate using handleEvents.
But it turned out that none of those publisher events occur.
Does anyone maybe has an idea what I am doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions