From 62f2991dbfbe2b80e2fc8a8033af8f6866583605 Mon Sep 17 00:00:00 2001 From: beyaz Date: Mon, 19 Feb 2024 00:38:29 +0300 Subject: [PATCH] . --- .../wwwroot/react-with-dotnet/react-with-dotnet.jsx | 12 +++++++++--- .../react-with-dotnet/react-with-dotnet.jsx | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) 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')