always respect _can_refresh_parent

This commit is contained in:
Pierre Chapuis 2023-09-01 15:10:07 +02:00
parent d389d11a06
commit bd59790e08
2 changed files with 3 additions and 1 deletions

View file

@ -142,7 +142,7 @@ class Chain(ContextModule):
self._reset_context()
for module in self:
if isinstance(module, ContextModule) and module._can_refresh_parent and module.parent != self:
if isinstance(module, ContextModule) and module.parent != self:
module._set_parent(self)
@property

View file

@ -62,6 +62,8 @@ class ContextModule(Module):
return self._parent[0]
def _set_parent(self, parent: "Chain | None") -> None:
if not self._can_refresh_parent:
return
if parent is None:
self._parent = []
return