File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ def __init__(
5151 self ._kwargs = kwargs
5252 self .key = key
5353
54+ @property
55+ def definition_id (self ) -> int :
56+ return id (self ._func )
57+
5458 def render (self ) -> VdomDict :
5559 model = self ._func (* self ._args , ** self ._kwargs )
5660 if isinstance (model , ComponentType ):
Original file line number Diff line number Diff line change @@ -511,6 +511,10 @@ def _update_component_model_state(
511511 life_cycle_state = (
512512 _update_life_cycle_state (old_model_state .life_cycle_state , new_component )
513513 if old_model_state .is_component_state
514+ and (
515+ old_model_state .life_cycle_state .component .definition_id
516+ == new_component .definition_id
517+ )
514518 else _make_life_cycle_state (new_component , schedule_render )
515519 ),
516520 )
Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ class ComponentType(Protocol):
3232 key : Key | None
3333 """An identifier which is unique amongst a component's immediate siblings"""
3434
35+ definition_id : int
36+ """A globally unique identifier for this component definition.
37+
38+ Usually the :func:`id` of this class or an underlying function.
39+ """
40+
3541 def render (self ) -> VdomDict :
3642 """Render the component's :class:`VdomDict`."""
3743
You can’t perform that action at this time.
0 commit comments