From cbc943bebf366bbbc5b8d8023a53b1d571f58af1 Mon Sep 17 00:00:00 2001 From: nadijagraca Date: Thu, 26 Oct 2023 10:42:17 +0200 Subject: [PATCH] small changes due to pr comment --- vizro-core/src/vizro/models/_navigation/nav_bar.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/vizro-core/src/vizro/models/_navigation/nav_bar.py b/vizro-core/src/vizro/models/_navigation/nav_bar.py index 0b2dadb2e..b87d44555 100644 --- a/vizro-core/src/vizro/models/_navigation/nav_bar.py +++ b/vizro-core/src/vizro/models/_navigation/nav_bar.py @@ -19,11 +19,11 @@ class NavBar(VizroBaseModel): Args: pages (Optional[NavPagesType]): See [`NavPagesType`][vizro.models.types.NavPagesType]. Defaults to `None`. - items (List[NavItem]): List of NavItem models. Defaults to `None`. + items (List[NavItem]): List of NavItem models. Defaults to `[]`. """ pages: Optional[NavPagesType] = None - items: Optional[List[NavItem]] = None + items: List[NavItem] = [] @_log_call def pre_build(self): @@ -40,12 +40,6 @@ def pre_build(self): if isinstance(self.pages, dict): self.items = [NavItem(pages=value) for page, value in self.pages.items()] - @validator("items", always=True) - def _validate_items(cls, items): - if items is not None and not items: - raise ValueError("Ensure this value has at least 1 item.") - - return items @_log_call def build(self, active_page_id):