@@ -255,7 +255,7 @@ def _render_model_children(
255
255
key = child .get ("key" ) or hex (id (child ))[2 :]
256
256
elif isinstance (child , AbstractComponent ):
257
257
child_type = COMPONENT_TYPE
258
- key = getattr (child , "key" , "" ) or hex (id (child ))[2 :]
258
+ key = getattr (child , "key" , None ) or hex (id (child ))[2 :]
259
259
else :
260
260
child = str (child )
261
261
child_type = STRING_TYPE
@@ -288,6 +288,8 @@ def _render_model_children(
288
288
elif child_type is COMPONENT_TYPE :
289
289
old_child_state = old_state .children_by_key .get (key )
290
290
if old_child_state is not None :
291
+ old_component = old_child_state .life_cycle_hook .component
292
+ del self ._model_state_by_component_id [id (old_component )]
291
293
new_child_state = old_child_state .new (new_state , child )
292
294
else :
293
295
hook = LifeCycleHook (child , self )
@@ -329,10 +331,6 @@ def _unmount_model_states(self, old_states: List[_ModelState]) -> None:
329
331
hook = state .life_cycle_hook
330
332
hook .component_will_unmount ()
331
333
del self ._model_state_by_component_id [id (hook .component )]
332
- import gc
333
-
334
- print (state )
335
- print (gc .get_referrers (hook ))
336
334
to_unmount .extend (state .children_by_key .values ())
337
335
338
336
def __repr__ (self ) -> str :
0 commit comments