🐛 fix(custom_components.py): change display_name attribute type from str to Optional[str] to allow for None value

🔀 refactor(custom_components.py): remove unused to_dict_nameless method and update to_dict method signature to specify return type
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-12-09 23:37:52 -03:00
commit af7c1c614d

View file

@ -46,7 +46,7 @@ class Component(CustomComponent):
class CustomComponentFrontendNode(FrontendNode):
name: str = "CustomComponent"
display_name: str = None
display_name: Optional[str] = None
beta: bool = True
template: Template = Template(
type_name="CustomComponent",
@ -67,10 +67,8 @@ class CustomComponentFrontendNode(FrontendNode):
description: Optional[str] = None
base_classes: list[str] = []
def to_dict(self):
return super().to_dict()
def to_dict_nameless(self):
def to_dict(self) -> dict:
"""Returns a dict representation of the frontend node."""
self.process_base_classes()
return {
@ -85,4 +83,4 @@ class CustomComponentFrontendNode(FrontendNode):
"beta": self.beta,
"error": self.error,
},
}
}