Problem
To make previews (and Hot Design previews) useful for MVUX-based pages, we need a way to show a page in a realistic state without instantiating the real model. Mocking the model is expensive: models are injected with services (there is no DI in previews), so you end up needing factories, partial classes, and mocks for the whole business layer just to render a page.
A much less intrusive path is to let the design-time/preview XAML bind FeedView.Source directly to the plain mock data we already generate, instead of to an IFeed<T> / IState<T>.
Proposal
FeedView.Source should accept a constant (non-reactive) value and surface it through to the data templates as the Data of a successful message.
Today, when Source changes, FeedView casts the incoming object to a signal/message (IFeed<T>) and does nothing useful if that cast fails. The suggested change is to make that path conditional: if the value is not already a signal, wrap it in a Feed.Async-style constant feed and continue as normal.
Scope of this issue (PoC)
- Verify the current behavior — bind
FeedView.Source to a plain object and to a plain collection and record what actually happens. There is a suspicion that a plain collection may already pass straight through; confirm or refute it before writing any code.
- If it does not work, prototype the conditional wrap at the
Source-changed hook (non-signal value -> constant feed) and confirm the data templates render.
- Report back on what the change touches and whether it can be made without breaking existing
IFeed/IState sources.
Worth syncing with @dr1rrb on the intended behavior before changing anything — this may be intentional today.
Out of scope
Commands exposed on FeedView (e.g. refresh) are not expected to work against a constant source. Only Data matters for the preview scenario. Error/exception surfacing can be looked at separately.
Notes
Pairs with #3145 (descendant state-binding markup extension) — together they remove the need to mock MVUX models for previews.
Problem
To make previews (and Hot Design previews) useful for MVUX-based pages, we need a way to show a page in a realistic state without instantiating the real model. Mocking the model is expensive: models are injected with services (there is no DI in previews), so you end up needing factories, partial classes, and mocks for the whole business layer just to render a page.
A much less intrusive path is to let the design-time/preview XAML bind
FeedView.Sourcedirectly to the plain mock data we already generate, instead of to anIFeed<T>/IState<T>.Proposal
FeedView.Sourceshould accept a constant (non-reactive) value and surface it through to the data templates as theDataof a successful message.Today, when
Sourcechanges,FeedViewcasts the incoming object to a signal/message (IFeed<T>) and does nothing useful if that cast fails. The suggested change is to make that path conditional: if the value is not already a signal, wrap it in aFeed.Async-style constant feed and continue as normal.Scope of this issue (PoC)
FeedView.Sourceto a plain object and to a plain collection and record what actually happens. There is a suspicion that a plain collection may already pass straight through; confirm or refute it before writing any code.Source-changed hook (non-signal value -> constant feed) and confirm the data templates render.IFeed/IStatesources.Worth syncing with @dr1rrb on the intended behavior before changing anything — this may be intentional today.
Out of scope
Commands exposed on
FeedView(e.g. refresh) are not expected to work against a constant source. OnlyDatamatters for the preview scenario. Error/exception surfacing can be looked at separately.Notes
Pairs with #3145 (descendant state-binding markup extension) — together they remove the need to mock MVUX models for previews.