Skip to content

Commit f3d4ffe

Browse files
authored
Merge pull request #2483 from plotly/master-2.9.2
Master 2.9.2
2 parents 40d5f0a + b72e820 commit f3d4ffe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+885
-682
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

5+
## [2.9.2] - 2023-03-29
6+
7+
## Fixed
8+
9+
- [#2479](https://github.com/plotly/dash/pull/2479) Fix `KeyError` "Callback function not found for output [...], , perhaps you forgot to prepend the '@'?" issue when using duplicate callbacks targeting the same output. This issue would occur when the app is restarted or when running with multiple `gunicorn` workers.
10+
- [#2471](https://github.com/plotly/dash/pull/2471) Fix `allow_duplicate` output with clientside callback, fix [#2467](https://github.com/plotly/dash/issues/2467)
11+
- [#2473](https://github.com/plotly/dash/pull/2473) Fix background callbacks with different outputs but same function, fix [#2221](https://github.com/plotly/dash/issues/2221)
12+
513
## [2.9.1] - 2023-03-17
614

715
## Fixed

components/dash-core-components/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/dash-core-components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-core-components",
3-
"version": "2.9.0",
3+
"version": "2.9.1",
44
"description": "Core component suite for Dash",
55
"repository": {
66
"type": "git",
@@ -102,6 +102,6 @@
102102
"react-dom": ">=16"
103103
},
104104
"browserslist": [
105-
"last 7 years and not dead"
105+
"last 8 years and not dead"
106106
]
107107
}

components/dash-html-components/package-lock.json

Lines changed: 487 additions & 388 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/dash-html-components/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-html-components",
3-
"version": "2.0.9",
3+
"version": "2.0.10",
44
"description": "Vanilla HTML components for Dash",
55
"main": "lib/index.js",
66
"repository": {
@@ -33,11 +33,11 @@
3333
"react-dom": "^17.0.2"
3434
},
3535
"devDependencies": {
36-
"@babel/cli": "^7.19.3",
37-
"@babel/core": "^7.19.6",
38-
"@babel/preset-env": "^7.19.4",
36+
"@babel/cli": "^7.21.0",
37+
"@babel/core": "^7.21.3",
38+
"@babel/preset-env": "^7.20.2",
3939
"@babel/preset-react": "^7.18.6",
40-
"babel-loader": "^8.2.5",
40+
"babel-loader": "^9.1.2",
4141
"cheerio": "^0.22.0",
4242
"cross-env": "^7.0.3",
4343
"es-check": "^7.0.1",
@@ -48,7 +48,7 @@
4848
"react-docgen": "^5.4.3",
4949
"request": "^2.88.2",
5050
"string": "^3.3.3",
51-
"webpack": "^5.76.2",
51+
"webpack": "^5.76.3",
5252
"webpack-cli": "^4.10.0"
5353
},
5454
"files": [
@@ -59,6 +59,6 @@
5959
"react-dom": ">=17"
6060
},
6161
"browserslist": [
62-
"last 7 years and not dead"
62+
"last 8 years and not dead"
6363
]
6464
}

components/dash-table/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/dash-table/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-table",
3-
"version": "5.2.3",
3+
"version": "5.2.4",
44
"description": "Dash table",
55
"repository": {
66
"type": "git",
@@ -124,6 +124,6 @@
124124
"npm": ">=6.1.0"
125125
},
126126
"browserslist": [
127-
"last 7 years and not dead"
127+
"last 8 years and not dead"
128128
]
129129
}

dash/_callback.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import collections
2+
import uuid
23
from functools import wraps
34

45
import flask
@@ -245,7 +246,7 @@ def insert_callback(
245246
output, prevent_initial_call, config_prevent_initial_callbacks
246247
)
247248

248-
callback_id = create_callback_id(output)
249+
callback_id = create_callback_id(output, inputs)
249250
callback_spec = {
250251
"output": callback_id,
251252
"inputs": [c.to_dict() for c in inputs],
@@ -315,7 +316,9 @@ def wrap_func(func):
315316

316317
if long is not None:
317318
long_key = BaseLongCallbackManager.register_func(
318-
func, long.get("progress") is not None
319+
func,
320+
long.get("progress") is not None,
321+
callback_id,
319322
)
320323

321324
@wraps(func)
@@ -530,18 +533,14 @@ def register_clientside_callback(
530533
# If JS source is explicitly given, create a namespace and function
531534
# name, then inject the code.
532535
if isinstance(clientside_function, str):
533-
534-
out0 = output
535-
if isinstance(output, (list, tuple)):
536-
out0 = output[0]
537-
538-
namespace = f"_dashprivate_{out0.component_id}"
539-
function_name = out0.component_property
536+
namespace = "_dashprivate_clientside_funcs"
537+
# Just make sure every function has a different name if not provided.
538+
function_name = uuid.uuid4().hex
540539

541540
inline_scripts.append(
542541
_inline_clientside_template.format(
543-
namespace=namespace.replace('"', '\\"'),
544-
function_name=function_name.replace('"', '\\"'),
542+
namespace=namespace,
543+
function_name=function_name,
545544
clientside_function=clientside_function,
546545
)
547546
)

dash/_dash_renderer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
__version__ = "1.15.0"
3+
__version__ = "1.15.1"
44

55
_available_react_versions = {"16.14.0", "18.2.0"}
66
_available_reactdom_versions = {"16.14.0", "18.2.0"}
@@ -64,7 +64,7 @@ def _set_react_version(v_react, v_reactdom=None):
6464
{
6565
"relative_package_path": "dash-renderer/build/dash_renderer.min.js",
6666
"dev_package_path": "dash-renderer/build/dash_renderer.dev.js",
67-
"external_url": "https://unpkg.com/[email protected].0"
67+
"external_url": "https://unpkg.com/[email protected].1"
6868
"/build/dash_renderer.min.js",
6969
"namespace": "dash",
7070
},

dash/_utils.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,22 @@ def first(self, *names):
123123
return next(iter(self), {})
124124

125125

126-
def create_callback_id(output):
126+
def create_callback_id(output, inputs):
127127
# A single dot within a dict id key or value is OK
128128
# but in case of multiple dots together escape each dot
129129
# with `\` so we don't mistake it for multi-outputs
130+
hashed_inputs = None
131+
130132
def _concat(x):
133+
nonlocal hashed_inputs
131134
_id = x.component_id_str().replace(".", "\\.") + "." + x.component_property
132135
if x.allow_duplicate:
136+
if not hashed_inputs:
137+
hashed_inputs = hashlib.md5(
138+
".".join(str(x) for x in inputs).encode("utf-8")
139+
).hexdigest()
133140
# Actually adds on the property part.
134-
_id += f"@{uuid.uuid4().hex}"
141+
_id += f"@{hashed_inputs}"
135142
return _id
136143

137144
if isinstance(output, (list, tuple)):

0 commit comments

Comments
 (0)