Skip to content

Commit 71f968c

Browse files
committed
fix: async function delegates not being awaited
1 parent e18443e commit 71f968c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

InertiaNetCore/Models/InertiaProps.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@ internal async Task<InertiaProps> ToProcessedProps(bool isPartial, List<string>
1919
if(isPartial && value is not IAlwaysProp && !partials.Contains(key, StringComparer.InvariantCultureIgnoreCase))
2020
continue;
2121

22-
props.Add(key, value switch
22+
var computed = value switch
2323
{
24-
Func<Task<object?>> f => await f.Invoke(),
2524
Func<object?> f => f.Invoke(),
2625
Delegate d => d.DynamicInvoke(),
2726
IInvokableProp l => await l.InvokeToObject(),
2827
_ => value
29-
});
28+
};
29+
30+
if (computed is Task task)
31+
props.Add(key, await (task as dynamic)); // TODO: find a solution to avoid dynamic
32+
else
33+
props.Add(key, computed);
3034
}
3135

3236
return props;

0 commit comments

Comments
 (0)