Skip to content

Commit

Permalink
improve solution for subclassing problem: avoid appending to same lis…
Browse files Browse the repository at this point in the history
…t instance like base class
  • Loading branch information
falkoschindler committed Jul 19, 2023
1 parent 0967eb2 commit b88181f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions nicegui/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import inspect
import re
from copy import deepcopy
from copy import copy, deepcopy
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Optional, Union

Expand Down Expand Up @@ -79,11 +79,10 @@ def glob_absolute_paths(file: Union[str, Path]) -> List[Path]:
path = base / path
return sorted(path.parent.glob(path.name), key=lambda p: p.stem)

if cls.__base__ == Element:
cls.component = None
cls.libraries = []
cls.extra_libraries = []
cls.exposed_libraries = []
cls.component = copy(cls.component)
cls.libraries = copy(cls.libraries)
cls.extra_libraries = copy(cls.extra_libraries)
cls.exposed_libraries = copy(cls.exposed_libraries)
if component:
for path in glob_absolute_paths(component):
cls.component = register_vue_component(path)
Expand Down

0 comments on commit b88181f

Please sign in to comment.