-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Date only and time only is not supported in blazor change detection for parameters #55914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date only and time only is not supported in blazor change detection for parameters #55914
Conversation
|
@MackinnonBuck, may I please request a review for this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MattyLeslie! Looks good so far - just a few suggestions. Let me know if you'd like me to take it from here.
| public static event Action? OnHotReload; | ||
|
|
||
| public static void ClearImmutableTypeCache() | ||
| { | ||
| _immutableNonObjectTypesCache.Clear(); | ||
| } | ||
|
|
||
| public static void HotReloadHandler() | ||
| { | ||
| ClearImmutableTypeCache(); | ||
| OnHotReload?.Invoke(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like this hooks into the hot reload OnDeltaApplied event, so the cache will never get cleared.
This can all probably be reduced down to something like what we do for RouteView:
aspnetcore/src/Components/Components/src/RouteView.cs
Lines 23 to 29 in 870eec2
| static RouteView() | |
| { | |
| if (HotReloadManager.Default.MetadataUpdateSupported) | |
| { | |
| HotReloadManager.Default.OnDeltaApplied += _layoutAttributeCache.Clear; | |
| } | |
| } |
|
@MackinnonBuck If you're will to carry it over the line that would be great otherwise I'll address that feedback as soon as I get time. |
…mmutableAndUnchanged" test to account for the new behaviours of DateOnly and TimeOnly.
800f788 to
77fd269
Compare
#55914) Co-authored-by: Mackinnon Buck <[email protected]>
Add DateOnly and TimeOnly support in Blazor change detection
Summary of the changes (Less than 80 chars)
Add DateOnly and TimeOnly as known immutable types in Blazor change detection.
Description
Updated the
ChangeDetectionclass to includeDateOnlyandTimeOnlyin theIsKnownImmutableTypemethod. Introduced a caching mechanism to store immutability checks results using aConcurrentDictionary<T, U>for performance optimization. Added support for hot reload to clear the cache when a hot reload event occurs.Fixes #49021