Skip to content

Commit

Permalink
Change Router _emptyParametersDictionary to a regular Dictionary (#31460
Browse files Browse the repository at this point in the history
)

* Change Router _emptyParametersDictionary to a regular Dictionary

This allows for ReadOnlyDictionary to be trimmed in a default Blazor WASM app. Saving roughly 3 KB .br compressed.

Contributes to #30098

* Update src/Components/Components/src/Routing/Router.cs

Co-authored-by: James Newton-King <[email protected]>
  • Loading branch information
eerhardt and JamesNK authored Apr 3, 2021
1 parent 8d721cf commit 8f63065
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Components/Components/src/Routing/Router.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ namespace Microsoft.AspNetCore.Components.Routing
public class Router : IComponent, IHandleAfterRender, IDisposable
{
static readonly char[] _queryOrHashStartChar = new[] { '?', '#' };
static readonly ReadOnlyDictionary<string, object> _emptyParametersDictionary
= new ReadOnlyDictionary<string, object>(new Dictionary<string, object>());
// Dictionary is intentionally used instead of ReadOnlyDictionary to reduce Blazor size
static readonly IReadOnlyDictionary<string, object> _emptyParametersDictionary
= new Dictionary<string, object>();

RenderHandle _renderHandle;
string _baseUri;
Expand Down

0 comments on commit 8f63065

Please sign in to comment.