Effect cancellation via type name is being deprecated (.cancel(id: TimerID.self)
)
#2092
stephencelis
started this conversation in
General
Replies: 3 comments 1 reply
-
+1 Safety first 👷 |
Beta Was this translation helpful? Give feedback.
0 replies
-
I saw in a diff that this was what you all did, so I've already updated my codebase to reflect it :) it's a lot cleaner, that's for sure! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Is a case-ful enum your recommended way of doing this, as opposed to |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We wanted to announce an upcoming deprecation in TCA around effect cancellation coming in #2091. For a long time we have recommended and documented using static types as lightweight cancel IDs for effects. E.g.:
As much as we like this style, there is a bug in Swift that allows it to aggressively prune these symbols in release builds, which can even lead to breaking how cancellation works in your production TCA apps.
Because of this, we are deprecating support for this style, and will instead require simple hashable types, instead, which are not compiled out of release builds. Migration will require introducing a value to cancel with instead of relying on the type. E.g. you can add a
case
to the previously-empty enum:We hope it will be mostly painless, and that it will help you avoid introducing compiler-related bugs in your application.
Beta Was this translation helpful? Give feedback.
All reactions