Skip to content

Commit b9d7b98

Browse files
Jen-Unoclaude
andcommitted
fix(unocrm): drive the Contacts FeedView from the generated ContactsViewModel, not the mock
A FeedView must bind to a real feed, which only the code-generated view model provides — a plain mock record can't drive it. So: - ContactsPage seeds its design-time DataContext with `new ContactsViewModel()` (the generated VM whose parameterless ctor builds a ContactsModel + its reactive SourceContext); Hot Design is a live app, so the FeedView's list feed pumps and renders at design time. - ContactsPageMockData is removed (a workaround for the old plain-ListView approach; it can't feed a FeedView), along with the earlier ListFeed.Async mock hack. - ContactsPreviews now hosts the page with its generated VM (a single populated "Contacts" preview). The no-results state isn't authored: it depends on the live filter state, which can't be preset on the generated VM at design time. Verified: Debug build succeeds. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f1e235c commit b9d7b98

3 files changed

Lines changed: 11 additions & 64 deletions

File tree

studio/uno-crm/UnoCRM/Presentation/ContactsPage.xaml.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Mapsui.Projections;
44
using Mapsui.Styles;
55
using Mapsui.Tiling;
6-
using UnoCRM.Presentation.MockData;
76

87
namespace UnoCRM.Presentation;
98

@@ -19,9 +18,12 @@ public ContactsPage()
1918
{
2019
this.InitializeComponent();
2120

22-
// Design-time DataContext for Hot Design / Studio (seed on the page, never a child).
23-
// At runtime Uno.Extensions Navigation injects the generated ContactsModel VM.
24-
this.DataContext = ContactsPageMockData.Data;
21+
// Design-time DataContext for Hot Design / Studio: the code-generated ContactsViewModel. Its
22+
// parameterless ctor builds a ContactsModel and its reactive SourceContext, so the page's
23+
// FeedView is driven by a real list feed at design time — a FeedView needs a feed and cannot
24+
// be driven by the plain mock record. At runtime Navigation injects the mapped
25+
// ContactsViewModel, which overrides this.
26+
this.DataContext = new ContactsViewModel();
2527

2628
Loaded += OnLoaded;
2729
}

studio/uno-crm/UnoCRM/Presentation/MockData/ContactsPageMockData.cs

Lines changed: 0 additions & 51 deletions
This file was deleted.

studio/uno-crm/UnoCRM/Previews/ContactsPreviews.xaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:local="using:UnoCRM.Presentation"
5-
xmlns:mock="using:UnoCRM.Presentation.MockData"
65
xmlns:hd="using:Uno.UI.HotDesign"
76
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
87
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
98
mc:Ignorable="d">
109

11-
<!-- ContactsPage populated vs. no-results. Note: the Mapsui map is populated in code-behind (not
12-
data-bound), so it shows an empty basemap; the filters/stats/list are the bound surface. -->
13-
<hd:Preview PreviewName="All" Visibility="Collapsed">
14-
<local:ContactsPage DataContext="{x:Bind mock:ContactsPageMockData.Data}" />
15-
</hd:Preview>
16-
17-
<hd:Preview PreviewName="No Results" Visibility="Collapsed">
18-
<local:ContactsPage DataContext="{x:Bind mock:ContactsPageMockData.NoResults}" />
10+
<!-- ContactsPage driven by its code-generated ContactsViewModel (seeded in the page ctor), so the
11+
FeedView renders real contacts. The empty / no-results state isn't authored here because it
12+
depends on the live filter state, which can't be preset on the generated VM at design time. -->
13+
<hd:Preview PreviewName="Contacts" Visibility="Collapsed">
14+
<local:ContactsPage />
1915
</hd:Preview>
2016
</hd:PreviewGroup>

0 commit comments

Comments
 (0)