Skip to content

Commit

Permalink
Merge pull request #2483 from plotly/master-2.9.2
Browse files Browse the repository at this point in the history
Master 2.9.2
  • Loading branch information
T4rk1n committed Mar 29, 2023
2 parents 40d5f0a + b72e820 commit f3d4ffe
Show file tree
Hide file tree
Showing 43 changed files with 885 additions and 682 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
All notable changes to `dash` will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

## [2.9.2] - 2023-03-29

## Fixed

- [#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.
- [#2471](https://github.com/plotly/dash/pull/2471) Fix `allow_duplicate` output with clientside callback, fix [#2467](https://github.com/plotly/dash/issues/2467)
- [#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)

## [2.9.1] - 2023-03-17

## Fixed
Expand Down
4 changes: 2 additions & 2 deletions components/dash-core-components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/dash-core-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-core-components",
"version": "2.9.0",
"version": "2.9.1",
"description": "Core component suite for Dash",
"repository": {
"type": "git",
Expand Down Expand Up @@ -102,6 +102,6 @@
"react-dom": ">=16"
},
"browserslist": [
"last 7 years and not dead"
"last 8 years and not dead"
]
}
875 changes: 487 additions & 388 deletions components/dash-html-components/package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions components/dash-html-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-html-components",
"version": "2.0.9",
"version": "2.0.10",
"description": "Vanilla HTML components for Dash",
"main": "lib/index.js",
"repository": {
Expand Down Expand Up @@ -33,11 +33,11 @@
"react-dom": "^17.0.2"
},
"devDependencies": {
"@babel/cli": "^7.19.3",
"@babel/core": "^7.19.6",
"@babel/preset-env": "^7.19.4",
"@babel/cli": "^7.21.0",
"@babel/core": "^7.21.3",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"babel-loader": "^8.2.5",
"babel-loader": "^9.1.2",
"cheerio": "^0.22.0",
"cross-env": "^7.0.3",
"es-check": "^7.0.1",
Expand All @@ -48,7 +48,7 @@
"react-docgen": "^5.4.3",
"request": "^2.88.2",
"string": "^3.3.3",
"webpack": "^5.76.2",
"webpack": "^5.76.3",
"webpack-cli": "^4.10.0"
},
"files": [
Expand All @@ -59,6 +59,6 @@
"react-dom": ">=17"
},
"browserslist": [
"last 7 years and not dead"
"last 8 years and not dead"
]
}
4 changes: 2 additions & 2 deletions components/dash-table/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions components/dash-table/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-table",
"version": "5.2.3",
"version": "5.2.4",
"description": "Dash table",
"repository": {
"type": "git",
Expand Down Expand Up @@ -124,6 +124,6 @@
"npm": ">=6.1.0"
},
"browserslist": [
"last 7 years and not dead"
"last 8 years and not dead"
]
}
21 changes: 10 additions & 11 deletions dash/_callback.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import collections
import uuid
from functools import wraps

import flask
Expand Down Expand Up @@ -245,7 +246,7 @@ def insert_callback(
output, prevent_initial_call, config_prevent_initial_callbacks
)

callback_id = create_callback_id(output)
callback_id = create_callback_id(output, inputs)
callback_spec = {
"output": callback_id,
"inputs": [c.to_dict() for c in inputs],
Expand Down Expand Up @@ -315,7 +316,9 @@ def wrap_func(func):

if long is not None:
long_key = BaseLongCallbackManager.register_func(
func, long.get("progress") is not None
func,
long.get("progress") is not None,
callback_id,
)

@wraps(func)
Expand Down Expand Up @@ -530,18 +533,14 @@ def register_clientside_callback(
# If JS source is explicitly given, create a namespace and function
# name, then inject the code.
if isinstance(clientside_function, str):

out0 = output
if isinstance(output, (list, tuple)):
out0 = output[0]

namespace = f"_dashprivate_{out0.component_id}"
function_name = out0.component_property
namespace = "_dashprivate_clientside_funcs"
# Just make sure every function has a different name if not provided.
function_name = uuid.uuid4().hex

inline_scripts.append(
_inline_clientside_template.format(
namespace=namespace.replace('"', '\\"'),
function_name=function_name.replace('"', '\\"'),
namespace=namespace,
function_name=function_name,
clientside_function=clientside_function,
)
)
Expand Down
4 changes: 2 additions & 2 deletions dash/_dash_renderer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

__version__ = "1.15.0"
__version__ = "1.15.1"

_available_react_versions = {"16.14.0", "18.2.0"}
_available_reactdom_versions = {"16.14.0", "18.2.0"}
Expand Down Expand Up @@ -64,7 +64,7 @@ def _set_react_version(v_react, v_reactdom=None):
{
"relative_package_path": "dash-renderer/build/dash_renderer.min.js",
"dev_package_path": "dash-renderer/build/dash_renderer.dev.js",
"external_url": "https://unpkg.com/dash-renderer@1.15.0"
"external_url": "https://unpkg.com/dash-renderer@1.15.1"
"/build/dash_renderer.min.js",
"namespace": "dash",
},
Expand Down
11 changes: 9 additions & 2 deletions dash/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,22 @@ def first(self, *names):
return next(iter(self), {})


def create_callback_id(output):
def create_callback_id(output, inputs):
# A single dot within a dict id key or value is OK
# but in case of multiple dots together escape each dot
# with `\` so we don't mistake it for multi-outputs
hashed_inputs = None

def _concat(x):
nonlocal hashed_inputs
_id = x.component_id_str().replace(".", "\\.") + "." + x.component_property
if x.allow_duplicate:
if not hashed_inputs:
hashed_inputs = hashlib.md5(
".".join(str(x) for x in inputs).encode("utf-8")
).hexdigest()
# Actually adds on the property part.
_id += f"@{uuid.uuid4().hex}"
_id += f"@{hashed_inputs}"
return _id

if isinstance(output, (list, tuple)):
Expand Down
Loading

0 comments on commit f3d4ffe

Please sign in to comment.