unoplatform / uno.extensions

Libraries to ease common developer tasks associated with building multi-platform mobile, desktop and web applications using Uno Platform or WinAppSDK.
https://platform.uno/
Other
73 stars 44 forks source link

[Mvux] Provide guidance on maintaining coherent state throughout an app #1572

Open nickrandolph opened 1 year ago

nickrandolph commented 1 year ago

From https://github.com/unoplatform/uno.extensions/pull/1566:

I feel it misses the main point: "how do we ensure we have a coherent state throughout the app?"

Do you ever ended in the situation where you have to pass object between view models? Did you ever awaited the result of a page to obtain an updated object? Or even worse... SEND AN UPDATED OBJECT VIA A MEDIATOR PATTERN TO ALL YOUR VIEW MODELS! crowd in shock And how it made you feel? Bad uh? Like sick to the stomach bad... Wouldn't it be better to be sure that the state of an object is distributed to all subscribers as soon as it's updated? Wouldn't it be rad if you didn't have to bother subscribing and unsuscribing to events to do so?

Or maybe I didn't understand what mvux is about :) It could very well be the case cause I didn't find a sample showcasing this use case...

Feeds.md // note that a service does not normally hold data // this example is for demonstration purposes

Why not? The service layer could cache data by using local repositories or even caching it itself if using a repository pattern is overkill. Also, if we want to have a coherent state dispatched to all our models, it should be stored in the service layer.

weitzhandler commented 1 year ago

Do you ever ended in the situation where you have to pass object between view models? Did you ever awaited the result of a page to obtain an updated object? Or even worse... SEND AN UPDATED OBJECT VIA A MEDIATOR PATTERN TO ALL YOUR VIEW MODELS! crowd in shock And how it made you feel? Bad uh? Like sick to the stomach bad... Wouldn't it be better to be sure that the state of an object is distributed to all subscribers as soon as it's updated? Wouldn't it be rad if you didn't have to bother subscribing and unsuscribing to events to do so?

Is this the one asking for the use of messaging? #1568?

Feeds.md // note that a service does not normally hold data // this example is for demonstration purposes

Why not? The service layer could cache data by using local repositories or even caching it itself if using a repository pattern is overkill. Also, if we want to have a coherent state dispatched to all our models, it should be stored in the service layer.

@nickrandolph please instruct if I should delete those comments