Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
beyaz committed Feb 4, 2024
1 parent ad8e46d commit a32916e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ReactWithDotNet/ElementSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ propertyValue is Expression<Func<bool>>||
transformFunction = transformValueInClientAttribute?.TransformFunction
};

var (success, handlerComponentUniqueIdentifier) = GetHandlerComponentUniqueIdentifierFromBindingExpression(propertyValueAsLambdaExpression);
var (success, handlerComponentUniqueIdentifier) = GetHandlerComponentUniqueIdentifierFromBindingExpression(context,propertyValueAsLambdaExpression);
if (!success)
{
throw HandlerMethodShouldBelongToReactComponent(propertyInfo, propertyValueAsLambdaExpression.ToString());
Expand Down Expand Up @@ -625,7 +625,7 @@ static async Task<object> GetPropertyValueOfHtmlElement(ElementSerializerContext
transformFunction = propertyDefinition.transformValueInClient
};

var (success, handlerComponentUniqueIdentifier) = GetHandlerComponentUniqueIdentifierFromBindingExpression(propertyValueAsLambdaExpression);
var (success, handlerComponentUniqueIdentifier) = GetHandlerComponentUniqueIdentifierFromBindingExpression(context,propertyValueAsLambdaExpression);
if (!success)
{
throw HandlerMethodShouldBelongToReactComponent(propertyDefinition.name, propertyValueAsLambdaExpression.ToString());
Expand Down Expand Up @@ -659,14 +659,16 @@ static async Task<object> GetPropertyValueOfHtmlElement(ElementSerializerContext
return propertyValue;
}

static (bool success, int value) GetHandlerComponentUniqueIdentifierFromBindingExpression(LambdaExpression lambdaExpression)
static (bool success, int value) GetHandlerComponentUniqueIdentifierFromBindingExpression(ElementSerializerContext context, LambdaExpression lambdaExpression)
{
var (success, targetValue) = GetTargetValueFromExpression(lambdaExpression);
if (success)
{
if (targetValue is ReactComponentBase targetValueAsReactComponentBase)
var handlerComponentUniqueIdentifier = TryFindHandlerComponentUniqueIdentifier(context, targetValue);

if (handlerComponentUniqueIdentifier.HasValue)
{
return (true, targetValueAsReactComponentBase.ComponentUniqueIdentifier);
return (true, handlerComponentUniqueIdentifier.Value);
}
}

Expand Down

0 comments on commit a32916e

Please sign in to comment.