-
Notifications
You must be signed in to change notification settings - Fork 169
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
Make datatypes Parcelable and Stable #1044
Conversation
If the object is parcelable, then here rememberSaveable can be used directly (no need to manually convert to json). |
I took a stab at replacing it but it does not work with nullable types. inline fun <reified D : Parcelable?> NavController.takeDepsFromRoot(): State<D> {
val deps = rootChannel<D>().take()
// This will survive process death
val depsSaved = rememberSaveable { deps!! }
// After process death, deps will be null
return remember(depsSaved) {
derivedStateOf {
deps ?: depsSaved
}
}
} |
I think a null check will solve this. If the deps is null, then it'll be null anyway after process death also. |
Yes but for a non nullable on process death, |
oh okay, I see. Can we make D non-nullable and return State<D?> Edit: I think we can make D non-nullable and return State< D > itself. I don't see how the returned type would be nullable tbh. |
How would that work for nullable types? Currently we have one, createPost has |
I didn't expect nullability to be a problem tbh. Ig we need to create a wrapper for that which contains a Community? within it. Removing one hack is requiring another. smh. |
Alright, I ll make a separate issue for this and keep |
I used v0.18.0 to generate the types it seems to added a few properties. Not sure if I did hot_rank correctly.
This pr makes all the datatypes Parceable and makes the one that weren't stable, stable due to them using List.
This fixes 33 datatypes that were previously unstable.
Example
after
Fixes #810
@nahwneeth not sure for what you needed them Parcelable though