reactpy-django icon indicating copy to clipboard operation
reactpy-django copied to clipboard

Fix `django_form` events sometimes not occurring

Open Archmonger opened this issue 1 year ago • 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: https://github.com/reactive-python/reactpy/pull/1169

Archmonger avatar Dec 11 '24 05:12 Archmonger