From f7e57ba55ea9c1babd2f9eb1ad5a4b16cea837df Mon Sep 17 00:00:00 2001 From: Emil Haldrup Eriksen Date: Mon, 2 Oct 2023 20:48:27 +0200 Subject: [PATCH] Attempt at fixing possible bug in assign function --- CHANGELOG.md | 6 ++++++ dash_extensions/javascript.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d698399..7bbba1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## [1.0.4] - 31-07-23 + +### Changed + +- Added `SerializationTransform` and `DataclassTransform` + ## [1.0.3] - 31-07-23 ### Added 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