Skip to content

Commit fc8e688

Browse files
committed
move effect kick-off into component did render
1 parent 8477156 commit fc8e688

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/py/reactpy/reactpy/core/_life_cycle_hook.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,19 @@ async def affect_component_will_render(self, component: ComponentType) -> None:
202202

203203
async def affect_component_did_render(self) -> None:
204204
"""The component completed a render"""
205-
self.unset_current()
205+
stop = Event()
206+
self._effect_stops.append(stop)
207+
self._effect_tasks.extend(create_task(e(stop)) for e in self._effect_funcs)
208+
self._effect_funcs.clear()
206209
self._rendered_atleast_once = True
207210
self._current_state_index = 0
208211
self._render_access.release()
209212
del self.component
213+
self.unset_current()
210214

211215
async def affect_layout_did_render(self) -> None:
212216
"""The layout completed a render"""
213-
stop = Event()
214-
self._effect_stops.append(stop)
215-
self._effect_tasks.extend(create_task(e(stop)) for e in self._effect_funcs)
216-
self._effect_funcs.clear()
217+
pass
217218

218219
async def affect_component_will_unmount(self) -> None:
219220
"""The component is about to be removed from the layout"""

0 commit comments

Comments
 (0)