Skip to content

Commit 2801e61

Browse files
committed
clean-up and fix for pmc
1 parent d19f04c commit 2801e61

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

dash/_callback_context.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import flask
66

77
from . import exceptions
8+
from ._utils import stringify_id
89

910

1011
def has_context(func):
@@ -76,14 +77,12 @@ def args_grouping(self):
7677

7778
def update_args_grouping(g):
7879
if isinstance(g, dict) and "id" in g:
79-
prop_id = ".".join((g["id"], g["property"]))
80+
str_id = stringify_id(g["id"])
81+
prop_id = "{}.{}".format(str_id, g["property"])
8082

8183
new_values = {
8284
"value": g.get("value"),
83-
"id": g["id"]
84-
if not g["id"].startswith("{")
85-
else json.loads(g["id"]),
86-
"property": g["property"],
85+
"str_id": str_id,
8786
"triggered": prop_id in triggered,
8887
}
8988
g.update(new_values)

dash/_utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ def inputs_to_dict(inputs_list):
168168
return inputs
169169

170170

171+
def convert_to_AttributeDict(nested_list):
172+
new_dict = []
173+
for i in nested_list:
174+
if isinstance(i, dict):
175+
new_dict.append(AttributeDict(i))
176+
else:
177+
new_dict.append([AttributeDict(ii) for ii in i])
178+
return new_dict
179+
180+
171181
def inputs_to_vals(inputs):
172182
return [
173183
[ii.get("value") for ii in i] if isinstance(i, list) else i.get("value")

dash/dash.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
patch_collections_abc,
4949
split_callback_id,
5050
to_json,
51+
convert_to_AttributeDict,
5152
)
5253
from . import _callback
5354
from . import _get_paths
@@ -1310,7 +1311,8 @@ def dispatch(self):
13101311
# Add args_grouping
13111312
inputs_state_indices = cb["inputs_state_indices"]
13121313
inputs_state = inputs + state
1313-
inputs_state = [AttributeDict(i) for i in inputs_state]
1314+
inputs_state = convert_to_AttributeDict(inputs_state)
1315+
13141316
args_grouping = map_grouping(
13151317
lambda ind: inputs_state[ind], inputs_state_indices
13161318
)

0 commit comments

Comments
 (0)