By submitting this pull request you agree that all contributions to this project are made under the MIT license.
Issues
Currently ReactPy renders components sequentially. This means that larger renders can block smaller updates from taking place which impacts responsiveness of the page. Sequential renders are also problematic for async effects since effects which are slow to start and stop can similarly impact the responsiveness of a page.
Solution
This change now allow renders to take place concurrently. To keep things simple, no effort is made to deduplicate renders. For example, if parent and child components are scheduled to render at the same time, both scheduled renders will take place even though a single render of the parent component would be sufficient to update the view.
Concurrent renders are achieved by "asyncifying" the internals of the Layout class. Additionally all scheduled renders immediately result in a "render task" being started. To avoid rendering the same component at the same time, we introduce a semaphore inside LifeCycleHooks that must be acquired before a component is rendered.
By submitting this pull request you agree that all contributions to this project are made under the MIT license.
Issues
Currently ReactPy renders components sequentially. This means that larger renders can block smaller updates from taking place which impacts responsiveness of the page. Sequential renders are also problematic for async effects since effects which are slow to start and stop can similarly impact the responsiveness of a page.
Solution
This change now allow renders to take place concurrently. To keep things simple, no effort is made to deduplicate renders. For example, if parent and child components are scheduled to render at the same time, both scheduled renders will take place even though a single render of the parent component would be sufficient to update the view.
Concurrent renders are achieved by "asyncifying" the internals of the
Layout
class. Additionally all scheduled renders immediately result in a "render task" being started. To avoid rendering the same component at the same time, we introduce a semaphore insideLifeCycleHook
s that must be acquired before a component is rendered.Note: this contains a subset of the changes originally created in https://github.com/reactive-python/reactpy/pull/1093
Checklist
changelog.rst
has been updated with any significant changes.