getndazn / kopytko-framework

A modern Roku's Brightscript framework based on JS world's solutions
MIT License
19 stars 6 forks source link

feat: added enqueueUpdate function to reduce number of rerenders #28

Closed RadoslawZambrowski closed 2 years ago

RadoslawZambrowski commented 2 years ago

What did you implement:

Added enqueueUpdate to Kopytko component to reduce the number of rerenders needed. Calling forceUpdate in a row would trigger multiple DOM updates. Thanks to the new function DOM will be updated only once in the next tick.

How did you implement it:

enqueueUpdate calls KopytkoUpdater.enqueueStateUpdatewith empty partialState and it behaves the same as setState function but m.state is not updated and no extra callbacks are triggered.

How can we verify it:

Create component outside of the Kopytko as in example in renderer.md, section Force update and enqueue update methods, and use setFields({...}) to update multiple fields at once. render function should be executed only once.

Todos:

Is this ready for review?: YES Is it a breaking change?: NO

github-actions[bot] commented 2 years ago

:tada: This PR is included in version 1.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: