Maximum ignores Inline Updates

Đang mở
#896 4 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@JakenVeina đang làm issue này rồi.

Từ ngày 29/5/2025.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

bug

Code to replicate the issue:

using DynamicData;
using DynamicData.Aggregation;
using DynamicDataRightJoin;

int? max = null;

var cache = new SourceCache<Foo, string>(foo => foo.Id);

var sub = cache
    .Connect()
    .TransformWithInlineUpdate(
        foo => new TransformedFoo(foo.Id)
        {
            TransformedValue = foo.Value
        },
        (transformedFoo, foo) =>
        {
            transformedFoo.TransformedValue = foo.Value;
        })
    .Maximum(transformedFoo => transformedFoo.TransformedValue)
    .Subscribe(newMax =>
    {
        max = newMax;
    });

cache.AddOrUpdate(new Foo("0")
{
    Value = 0
});

Console.WriteLine(max); // 0

cache.AddOrUpdate(new Foo("0")
{
    Value = 1
});

Console.WriteLine(max); // Expected: 1, Actual: 0

sub.Dispose();

If I understood correctly, this is because:

  • TransformWithInlineUpdate calls cache.Refresh(change.Key); when inline updating even if the change reason was Update. Is this intended?
  • ForAggregation ignores changes which reason is Refresh.

Originally posted by @glrusso in https://github.com/reactivemarbles/DynamicData/discussions/895#discussioncomment-9156245

Ngôn ngữ chính
C#
Star
1.9k
Fork
194
Merge trung bình
12 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của reactivemarbles/DynamicData

Tất cả issue của reactivemarbles/DynamicData

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.