Skip to content

Commit 1b3f328

Browse files
committed
Outputs DeprecationWarning if LogoutButton is used in layout
1 parent b13d9b8 commit 1b3f328

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

dash/_validate.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22
from collections.abc import MutableSequence
33
import re
4+
import warnings
45
from textwrap import dedent
56
from keyword import iskeyword
67
import flask
@@ -422,6 +423,15 @@ def validate_layout(layout, layout_value):
422423
component_ids = set()
423424

424425
def _validate(value):
426+
def _validate_type(comp):
427+
deprecated_types = ["LogoutButton"]
428+
component_type = getattr(comp, "_type", None)
429+
if component_type and component_type in deprecated_types:
430+
warnings.warn(
431+
f"{component_type} is deprecated, use a different component type instead",
432+
DeprecationWarning,
433+
)
434+
425435
def _validate_id(comp):
426436
component_id = stringify_id(getattr(comp, "id", None))
427437
if component_id and component_id in component_ids:
@@ -432,9 +442,11 @@ def _validate_id(comp):
432442
)
433443
component_ids.add(component_id)
434444

445+
_validate_type(value)
435446
_validate_id(value)
436447

437448
for component in value._traverse(): # pylint: disable=protected-access
449+
_validate_type(component)
438450
_validate_id(component)
439451

440452
if isinstance(layout_value, (list, tuple)):

0 commit comments

Comments
 (0)