Skip to content

Commit c075bdb

Browse files
committed
Changed load log to sort in place instead of using the ImmutableArray
1 parent 3957c35 commit c075bdb

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/EventLogExpert.UI.Tests/Store/EventLog/EventLogStoreTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void EventLogAction_LoadEvents_ShouldStoreLogDataAndEvents()
113113

114114
// Assert
115115
Assert.Equal(logData, action.LogData);
116-
Assert.Equal(2, action.Events.Length);
116+
Assert.Equal(2, action.Events.Count);
117117
}
118118

119119
[Fact]

src/EventLogExpert.UI/Store/EventLog/EventLogAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public sealed record CloseAll;
2020

2121
public sealed record CloseLog(EventLogId LogId, string LogName);
2222

23-
public sealed record LoadEvents(EventLogData LogData, ImmutableArray<DisplayEventModel> Events);
23+
public sealed record LoadEvents(EventLogData LogData, IReadOnlyList<DisplayEventModel> Events);
2424

2525
public sealed record LoadNewEvents;
2626

src/EventLogExpert.UI/Store/EventLog/EventLogEffects.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ await Parallel.ForEachAsync(
195195
return;
196196
}
197197

198-
dispatcher.Dispatch(
199-
new EventLogAction.LoadEvents(
200-
logData,
201-
[.. events.OrderByDescending(e => e.RecordId)]));
198+
var sortedEvents = events.ToList();
199+
sortedEvents.Sort((a, b) => Comparer<long?>.Default.Compare(b.RecordId, a.RecordId));
200+
201+
dispatcher.Dispatch(new EventLogAction.LoadEvents(logData, sortedEvents));
202202

203203
dispatcher.Dispatch(new StatusBarAction.SetEventsLoading(activityId, 0, 0));
204204

0 commit comments

Comments
 (0)