Browse Source

do not break on evaluating expression in a client context that doesn't match.
resolves #2441

Fred Lefévère-Laoide 3 months ago
parent
commit
71f892014d
2 changed files with 5 additions and 1 deletions
  1. 2 0
      taipy/gui/gui.py
  2. 3 1
      taipy/gui/utils/_evaluator.py

+ 2 - 0
taipy/gui/gui.py

@@ -2298,6 +2298,8 @@ class Gui:
         partial = partials.get(route)
         if partial is None:
             partial = next((p for p in self._config.partials if p._route == route), None)
+            partials[route] = partial
+            _setscopeattr(self, Partial._PARTIALS, partials)
         return partial
 
     # Main binding method (bind in markdown declaration)

+ 3 - 1
taipy/gui/utils/_evaluator.py

@@ -375,13 +375,15 @@ class _Evaluator:
                         _setscopeattr(gui, hash_expr, expr_evaluated)
                     except Exception as e:
                         _warn(f"Exception raised evaluating {_Evaluator._clean_exception_expr(expr_string)}", e)
+                        hash_expr = ""
             # refresh holders if any
             for h in self.__expr_to_holders.get(expr, []):
                 holder_hash = self.__get_holder_hash(h, self.get_hash_from_expr(expr))
                 if holder_hash not in modified_vars:
                     _setscopeattr(gui, holder_hash, self.__evaluate_holder(gui, h, expr))
                     modified_vars.add(holder_hash)
-            modified_vars.add(hash_expr)
+            if hash_expr:
+                modified_vars.add(hash_expr)
         return modified_vars
 
     def _get_instance_in_context(self, name: str):