Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt at fixing possible bug in assign function #289

Merged
merged 2 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions dash_extensions/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading