reactive-python/reactpy-django

Fix `django_form` events sometimes not occurring

Opened this issue · 0 comments

Current Situation

Sometimes django_form events such as on_error will not be executed.

This appears to be caused by a race condition where the use_effect(render_form) hook could be cancelled prior to full execution.

It is presumed that this issue is related to current ReactPy use_effect design that cancels all async effects upon every re-render. The set_state function queues a render, and fact that set_state is asynchronously being called in several locations within the django_form component is likely causing abrupt re-renders (which subsequently causes early use_effect termination).

Proposed Actions

This issue will likely need to be resolved in ReactPy core, and might require creating an effect rendering queue on a per-component basis.

Related PR: reactive-python/reactpy#1169