diff --git a/CHANGELOG.md b/CHANGELOG.md index a42984f..cae82a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,8 @@ All notable changes to this project will be documented in this file. ### Changed - Dependencies updated -- A few bugfixes - -### Added - -- Added `SerializationTransform` and `DataclassTransform` +- Dynamic prefixing is now applied recursively +- Inline JS functions created using `assign` are now re-used if the code is identical ## [1.0.3] - 31-07-23 diff --git a/dash_extensions/javascript.py b/dash_extensions/javascript.py index d91b0ab..4c3c648 100644 --- a/dash_extensions/javascript.py +++ b/dash_extensions/javascript.py @@ -25,6 +25,11 @@ def __call__(self, var): return variable(*all_args) def add(self, src, name=None): + # Check if the function already exists. + for key in self.f_map: + if name is None and self.f_map[key] == src: + return key + # Otherwise add it. name = f"function{len(self.f_map)}" if name is None else name self.f_map[name] = src return name