Replies: 3 comments 2 replies
-
I'm a bit lost. What's the relationship between this "exists" and
|
Beta Was this translation helpful? Give feedback.
0 replies
-
The controller determines whether the category already exists as an async
operation.
Post-loading the notifier state should be either a category that already
exists or a category that does not already exist.
…On Sat, 27 Nov 2021, 13:17 Remi Rousselet, ***@***.***> wrote:
I'm a bit lost. What's the relationship between this "exists" and
AsyncData?
AsyncData is purely for having a synchronous representation of a Future/
Stream. It's unrelated to business logic
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#959 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE6N6TEZINFA77TL3EAGKLUODK6DANCNFSM5I4DAVHQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Maybe it's not. I have been thinking that the category is an entity that
doesn't need to know whether it's been persisted, however, perhaps it
should do. Certainly things fall more neatly into place that way.
…On Sat, 27 Nov 2021, 14:31 Remi Rousselet, ***@***.***> wrote:
Right, but why is that the responsibility of Asyncvalue and not category?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#959 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE6N6VR34ELMIJ5X2W52M3UODTT5ANCNFSM5I4DAVHQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
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
-
Hi,
I've got a situation where I have a model class
Category
that can be created on-device at runtime from a template category. I have a corresponding state notifier classCategoryController
.I need to differentiate between whether the category exists on the device or not. At first glance, this might be achieved by the controller holding an
AsyncValue<Category>
. However, this doesn't allow me to differentiate between an existing or new category, as both would result in anAsyncData
value.An easy "watchable" way to understand whether the category exists would be to extend the
Category
class with a flag to indicate whether it exists, however, I would prefer to avoid that as that's merging a UI-runtime attribute with the real model attributes.This leaves me with creating a wrapper class so that I end up with:
I don't like this idea because then using the category values becomes a bit unnatural:
I think what I really want is a subclass of AsyncData, but I don't believe that is currently possible.
Wondering if anyone has a better approach.
Beta Was this translation helpful? Give feedback.
All reactions