From 6540b8ce3ac78d1728e56a6545da28da6767b156 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Thu, 17 Oct 2024 11:16:09 -0700 Subject: [PATCH] foreach: convert return value to a Var When the value returned from the foreach is not hashable (mutable type), then it will raise an exception if it is not first converted to a LiteralVar. --- reflex/vars/sequence.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reflex/vars/sequence.py b/reflex/vars/sequence.py index 12e167a3e..e3b422f35 100644 --- a/reflex/vars/sequence.py +++ b/reflex/vars/sequence.py @@ -1167,7 +1167,10 @@ class ArrayVar(Var[ARRAY_VAR_TYPE]): _var_type=first_arg_type, ).guess_type() - function_var = ArgsFunctionOperation.create((arg_name,), fn(first_arg)) + function_var = ArgsFunctionOperation.create( + (arg_name,), + Var.create(fn(first_arg)), + ) return map_array_operation(self, function_var)