You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found the super-handy signpost() function on reducers and decided to take a look in instruments to check performance. I found something I don't understand, maybe I'm interpreting it wrong:
In my app, I have a Settings view that you can enter from the main view. When the Settings view appears, I send an onAppear Action to its reducer. In response to the onAppear Action, that reducer sets up initial state and returns a publisher effect that maps another publisher to fire another Action when that publish receives a new value.
While viewing the signposts in instruments for my Settings reducer's onAppear Action, I see that it keeps running even after the view is dismissed. While this is understandable as I use scope to create the Settings reducer from the app's main reducer, I don't understand why the Action itself is long-running. Here's a screenshot from instruments, I apologize for cutting off some of the entry due to propriety but bear with me:
In this instruments run, I entered and left the Settings view twice. After the initial onAppear the Action kept running according to the signposts. This is under the Action signpost category, not the Effect category
If I send onAppear to the store using await store.send(.onAppear).finish() this stops occurring.
Should I be calling finish() on sending actions with long-running publishers? Or is instruments potentially not reporting this correctly? Or, alternatively, is this a non-issue?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I found the super-handy
signpost()
function on reducers and decided to take a look in instruments to check performance. I found something I don't understand, maybe I'm interpreting it wrong:In my app, I have a Settings view that you can enter from the main view. When the Settings view appears, I send an
onAppear
Action to its reducer. In response to theonAppear
Action, that reducer sets up initial state and returns apublisher
effect that maps another publisher to fire anotherAction
when that publish receives a new value.While viewing the signposts in instruments for my Settings reducer's
onAppear
Action, I see that it keeps running even after the view is dismissed. While this is understandable as I usescope
to create the Settings reducer from the app's main reducer, I don't understand why theAction
itself is long-running. Here's a screenshot from instruments, I apologize for cutting off some of the entry due to propriety but bear with me:In this instruments run, I entered and left the Settings view twice. After the initial
onAppear
theAction
kept running according to the signposts. This is under theAction
signpost category, not theEffect
categoryIf I send
onAppear
to the store usingawait store.send(.onAppear).finish()
this stops occurring.Should I be calling
finish()
on sending actions with long-running publishers? Or is instruments potentially not reporting this correctly? Or, alternatively, is this a non-issue?Beta Was this translation helpful? Give feedback.
All reactions