on master help sign in
Replace ListBox with ScrollViewer+VStack to fix conversation view not updating on new messages
commit5feb6662d18e21810599668984fe623f2fdc584c authoriko <mail@iko.soy> dateSun 19 Apr 2026, 02:11 (6 months ago) parentd9813d4
1 file changed+37−37
client/ViewConversations.fs+37−37
client/ViewConversations.fs+37−37
@@ -32,51 +32,51 @@ module ViewConversations =
3232 )
3333 else
3434 AnyView(
35− ListBox(
36− contacts,
37− fun c ->
38− let name = contactName model.Contacts c.Pubkey
35+ ScrollViewer(
36+ VStack(0.) {
37+ for c in contacts do
38+ let name = contactName model.Contacts c.Pubkey
3939
40− let preview =
41− messagesFor c.Pubkey model.Messages
42− |> List.tryLast
43− |> Option.map (fun m -> if m.Body.Length > 40 then m.Body.[..39] + "..." else m.Body)
44− |> Option.defaultValue ""
40+ let preview =
41+ messagesFor c.Pubkey model.Messages
42+ |> List.tryLast
43+ |> Option.map (fun m -> if m.Body.Length > 40 then m.Body.[..39] + "..." else m.Body)
44+ |> Option.defaultValue ""
4545
46− Border(
47− (HStack(8.) {
46+ Border(
47+ (HStack(8.) {
4848
49− Grid() {
50− (match c.Photo with
51− | None -> Image("avares://Skrepka/Assets/Images/user.png", Stretch.Uniform)
52− | Some i -> Image(cachedBitmap i, Stretch.UniformToFill))
53− .width(16.)
54− .height(16.)
55− .margin(8.)
56− .clipToBounds (true)
49+ Grid() {
50+ (match c.Photo with
51+ | None -> Image("avares://Skrepka/Assets/Images/user.png", Stretch.Uniform)
52+ | Some i -> Image(cachedBitmap i, Stretch.UniformToFill))
53+ .width(16.)
54+ .height(16.)
55+ .margin(8.)
56+ .clipToBounds (true)
5757
58− Rectangle().stroke(Colors.Black).strokeThickness (4.)
59− }
58+ Rectangle().stroke(Colors.Black).strokeThickness (4.)
59+ }
6060
61− VStack(2.) {
62− TextBlock(name)
63− .fontFamily(Constants.fontFamily)
64− .fontWeight(FontWeight.Bold)
65− .fontSize (16.)
61+ VStack(2.) {
62+ TextBlock(name)
63+ .fontFamily(Constants.fontFamily)
64+ .fontWeight(FontWeight.Bold)
65+ .fontSize (16.)
6666
67− if preview <> "" then
68− TextBlock(preview).fontSize(12.).fontWeight (FontWeight.Bold)
69− }
67+ if preview <> "" then
68+ TextBlock(preview).fontSize(12.).fontWeight (FontWeight.Bold)
69+ }
7070
71− })
72− .margin (8.)
73− )
74− .borderThickness(Avalonia.Thickness(0., 0., 0., 4.))
75− .borderBrush(SolidColorBrush(Colors.Black))
76− .background(Colors.Transparent)
77− .onTapped (fun _ -> SetPage(Chat(c.Pubkey, "")))
71+ })
72+ .margin (8.)
73+ )
74+ .borderThickness(Avalonia.Thickness(0., 0., 0., 4.))
75+ .borderBrush(SolidColorBrush(Colors.Black))
76+ .background(Colors.Transparent)
77+ .onTapped (fun _ -> SetPage(Chat(c.Pubkey, "")))
78+ }
7879 )
79− .styles(noListBoxPadding ())
8080 .background(Colors.White)
8181 .verticalAlignment (VerticalAlignment.Bottom)
8282 )