Skip to content

Commit 6fc9900

Browse files
committed
added AttributeDict to PMC ids
added to .start method in AttributeDict
1 parent 1d957ea commit 6fc9900

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

dash/_callback_context.py

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

77
from . import exceptions
8-
from ._utils import stringify_id
8+
from ._utils import stringify_id, AttributeDict
99

1010

1111
def has_context(func):
@@ -60,12 +60,12 @@ def triggered(self):
6060
@has_context
6161
def triggered_ids(self):
6262
triggered = getattr(flask.g, "triggered_inputs", [])
63-
ids = {}
63+
ids = AttributeDict({})
6464
for item in triggered:
6565
component_id, _, _ = item["prop_id"].rpartition(".")
6666
ids[item["prop_id"]] = component_id
6767
if component_id.startswith("{"):
68-
ids[item["prop_id"]] = json.loads(component_id)
68+
ids[item["prop_id"]] = AttributeDict(json.loads(component_id))
6969
return ids
7070

7171
@property
@@ -84,6 +84,9 @@ def update_args_grouping(g):
8484
"value": g.get("value"),
8585
"str_id": str_id,
8686
"triggered": prop_id in triggered,
87+
"id": AttributeDict(g["id"])
88+
if isinstance(g["id"], dict)
89+
else g["id"],
8790
}
8891
g.update(new_values)
8992

dash/_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ def first(self, *names):
119119
value = self.get(name)
120120
if value:
121121
return value
122+
if names == ():
123+
return next(iter(self), {})
122124

123125

124126
def create_callback_id(output):

0 commit comments

Comments
 (0)