File tree 3 files changed +14
-0
lines changed
3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ def __init__(
51
51
self ._kwargs = kwargs
52
52
self .key = key
53
53
54
+ @property
55
+ def definition_id (self ) -> int :
56
+ return id (self ._func )
57
+
54
58
def render (self ) -> VdomDict :
55
59
model = self ._func (* self ._args , ** self ._kwargs )
56
60
if isinstance (model , ComponentType ):
Original file line number Diff line number Diff line change @@ -511,6 +511,10 @@ def _update_component_model_state(
511
511
life_cycle_state = (
512
512
_update_life_cycle_state (old_model_state .life_cycle_state , new_component )
513
513
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
+ )
514
518
else _make_life_cycle_state (new_component , schedule_render )
515
519
),
516
520
)
Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ class ComponentType(Protocol):
32
32
key : Key | None
33
33
"""An identifier which is unique amongst a component's immediate siblings"""
34
34
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
+
35
41
def render (self ) -> VdomDict :
36
42
"""Render the component's :class:`VdomDict`."""
37
43
You can’t perform that action at this time.
0 commit comments