Skip to content

Commit

Permalink
mark old state as None if unmounting
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorshea committed Feb 3, 2022
1 parent 1a2805c commit 384bd42
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/idom/_option.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,15 @@ def current(self) -> _O:
DeprecationWarning,
)
return super().current

@current.setter
def current(self, new: _O) -> None:
if self.new_name is None:
warnings.warn(f"{self.name!r} has been removed", DeprecationWarning)
else:
warnings.warn(
f"{self.name!r} has been renamed to {self.new_name!r}",
DeprecationWarning,
)
self.set_current(new)
return None

0 comments on commit 384bd42

Please sign in to comment.