diff --git a/ReactWithDotNet.WebSite/wwwroot/react-with-dotnet/react-with-dotnet.jsx b/ReactWithDotNet.WebSite/wwwroot/react-with-dotnet/react-with-dotnet.jsx index 8f29a21a..549175c4 100644 --- a/ReactWithDotNet.WebSite/wwwroot/react-with-dotnet/react-with-dotnet.jsx +++ b/ReactWithDotNet.WebSite/wwwroot/react-with-dotnet/react-with-dotnet.jsx @@ -1830,14 +1830,20 @@ function HandleComponentClientTasks(component) function DefineComponent(componentDeclaration) { - const dotNetTypeOfReactComponent = componentDeclaration[DotNetTypeOfReactComponent]; + var cacheKeyForComponentDefinitions = componentDeclaration[DotNetTypeOfReactComponent]; - const component = ComponentDefinitions[dotNetTypeOfReactComponent]; + if (cacheKeyForComponentDefinitions === 'ReactWithDotNet.FunctionalComponent,ReactWithDotNet') + { + cacheKeyForComponentDefinitions = componentDeclaration[DotNetProperties].RenderMethodNameWithToken; + } + const component = ComponentDefinitions[cacheKeyForComponentDefinitions]; if (component) { return component; } + const dotNetTypeOfReactComponent = componentDeclaration[DotNetTypeOfReactComponent]; + class NewComponent extends React.Component { constructor(props) @@ -2021,7 +2027,7 @@ function DefineComponent(componentDeclaration) NewComponent[DotNetTypeOfReactComponent] = dotNetTypeOfReactComponent; - ComponentDefinitions[dotNetTypeOfReactComponent] = NewComponent; + ComponentDefinitions[cacheKeyForComponentDefinitions] = NewComponent; NewComponent.displayName = dotNetTypeOfReactComponent.split(',')[0].split('.').pop(); if (NewComponent.displayName === 'FunctionalComponent') diff --git a/ReactWithDotNet/JsClientEngine/react-with-dotnet/react-with-dotnet.jsx b/ReactWithDotNet/JsClientEngine/react-with-dotnet/react-with-dotnet.jsx index 8f29a21a..549175c4 100644 --- a/ReactWithDotNet/JsClientEngine/react-with-dotnet/react-with-dotnet.jsx +++ b/ReactWithDotNet/JsClientEngine/react-with-dotnet/react-with-dotnet.jsx @@ -1830,14 +1830,20 @@ function HandleComponentClientTasks(component) function DefineComponent(componentDeclaration) { - const dotNetTypeOfReactComponent = componentDeclaration[DotNetTypeOfReactComponent]; + var cacheKeyForComponentDefinitions = componentDeclaration[DotNetTypeOfReactComponent]; - const component = ComponentDefinitions[dotNetTypeOfReactComponent]; + if (cacheKeyForComponentDefinitions === 'ReactWithDotNet.FunctionalComponent,ReactWithDotNet') + { + cacheKeyForComponentDefinitions = componentDeclaration[DotNetProperties].RenderMethodNameWithToken; + } + const component = ComponentDefinitions[cacheKeyForComponentDefinitions]; if (component) { return component; } + const dotNetTypeOfReactComponent = componentDeclaration[DotNetTypeOfReactComponent]; + class NewComponent extends React.Component { constructor(props) @@ -2021,7 +2027,7 @@ function DefineComponent(componentDeclaration) NewComponent[DotNetTypeOfReactComponent] = dotNetTypeOfReactComponent; - ComponentDefinitions[dotNetTypeOfReactComponent] = NewComponent; + ComponentDefinitions[cacheKeyForComponentDefinitions] = NewComponent; NewComponent.displayName = dotNetTypeOfReactComponent.split(',')[0].split('.').pop(); if (NewComponent.displayName === 'FunctionalComponent')