예제 #1
0
        private async void RenderRootComponentsOnHotReload()
        {
            // Before re-rendering the root component, also clear any well-known caches in the framework
            _componentFactory.ClearCache();
            ComponentProperties.ClearCache();
            Routing.QueryParameterValueSupplier.ClearCache();

            await Dispatcher.InvokeAsync(() =>
            {
                if (_rootComponentsLatestParameters is null)
                {
                    return;
                }

                IsRenderingOnMetadataUpdate = true;
                try
                {
                    foreach (var(componentId, parameters) in _rootComponentsLatestParameters)
                    {
                        var componentState = GetRequiredComponentState(componentId);
                        componentState.SetDirectParameters(parameters);
                    }
                }
                finally
                {
                    IsRenderingOnMetadataUpdate = false;
                }
            });
        }