Skip to content

Commit

Permalink
Avoid extra re-render when clicking calendar day
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchalmers committed Jun 11, 2024
1 parent 1019300 commit 0ea0a9f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion JournalApp/Pages/Calendar/CalendarPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{
<div style="padding-bottom: 40vh;">
<CalendarView GridYear="_gridYear.Value" OpenToDate="OpenToDate"
CalendarLoaded="ScrollToOpenToDate" DayClicked="@(d => Close(d))"
CalendarLoaded="ScrollToOpenToDate" DayClicked="@(EventUtil.AsNonRenderingEventHandler(Close))"
PreviousMonthClicked="PreviousMonth" NextMonthClicked="NextMonth" />
</div>
}
Expand Down
2 changes: 1 addition & 1 deletion JournalApp/Pages/Calendar/CalendarView.razor
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@foreach (var day in row)
{
<div class="@(day.Date == OpenToDate ? "mood-block-container mood-block-container-current" : "mood-block-container")" style="background-color: @(PreferenceService.GetMoodColor(day.Emoji));">
<div class="@(day.Emoji == null ? "mood-block mood-block-offset" : "mood-block mood-block-filled")" onclick="@(async () => await DayClicked.InvokeAsync(day.Date))">
<div class="@(day.Emoji == null ? "mood-block mood-block-offset" : "mood-block mood-block-filled")" @onclick="EventUtil.AsNonRenderingEventHandler(async () => await DayClicked.InvokeAsync(day.Date))">
@if (day.Date != null)
{
<b>@day.Date.Value.Day</b>
Expand Down

0 comments on commit 0ea0a9f

Please sign in to comment.