-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ResultDestination with sealed interface as result acting unpredictably #133
Comments
Also just to confirm: I switched to using a non-sealed interface and just testing with the |
Workaround for now seems to be: @Serializable
data class EditItem(
val listUrlLocator: ListUrlLocator,
val itemUrlLocator: ItemUrlLocator,
) : ListDestinations, ResultDestination<EditItem.Result> {
@Serializable
data class Result(val operation: Operation) {
@Serializable
sealed class Operation {
@Serializable
data class Updated(val itemUrlLocator: ItemUrlLocator) : Operation()
@Serializable
data object Deleted : Operation()
@Serializable
data class Archived(val itemUrlLocator: ItemUrlLocator) : Operation()
}
}
} |
That's the problem of KotlinX.Serialization and its limitation on polymorphism. There are two options: A: navController.setResult<ListDestinations.AddItem.Result>(ListDestinations.AddItem.Created) or B: AFAIK: there are no solutions, I spent hours finding something. |
maybe it would be worthwhile to add an example to the result sharing part of the readme? either way this can be closed :) |
I have the following destination/result setup:
and the effect side:
Graph setup:
The effect for
ListDestinations.AddItem.Created
fires without issue every time. The effect forListDestinations.EditItem.Result
sometimes fires, often times not. Unfortunately, attaching the debugger seems to make the effect consistently fire 😅. Not sure whats happening here.The text was updated successfully, but these errors were encountered: