File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
src/Components/Components/src/Routing Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -398,23 +398,14 @@ private void RenderNotFound()
398398 {
399399 if ( NotFoundPage != null )
400400 {
401+ builder . OpenComponent < RouteView > ( 0 ) ;
402+ builder . AddAttribute ( 1 , nameof ( RouteView . RouteData ) ,
403+ new RouteData ( NotFoundPage , _emptyParametersDictionary ) ) ;
401404 if ( _notFoundLayoutType is Type layoutType )
402405 {
403- // Directly instantiate the layout type, supplying the NotFoundPage as the Body
404- builder . OpenComponent ( 0 , layoutType ) ;
405- builder . AddAttribute ( 1 , LayoutComponentBase . BodyPropertyName ,
406- ( RenderFragment ) ( childBuilder =>
407- {
408- childBuilder . OpenComponent ( 2 , NotFoundPage ) ;
409- childBuilder . CloseComponent ( ) ;
410- } ) ) ;
411- builder . CloseComponent ( ) ;
412- }
413- else
414- {
415- builder . OpenComponent ( 0 , NotFoundPage ) ;
416- builder . CloseComponent ( ) ;
406+ builder . AddAttribute ( 2 , nameof ( RouteView . DefaultLayout ) , layoutType ) ;
417407 }
408+ builder . CloseComponent ( ) ;
418409 }
419410 else if ( NotFound != null )
420411 {
You can’t perform that action at this time.
0 commit comments