Fixes the problem when setState is called before initKopytko. Currently, update state callbacks are executed even if a component is not mounted and that may result in an app crash if the render function tries to access uninitialized fields.
How did you implement it:
KopytkoUpdater.enqueueStateUpdate additionally checks if a component is mounted before scheduling state update callbacks.
What did you implement:
Fixes the problem when
setState
is called beforeinitKopytko
. Currently, update state callbacks are executed even if a component is not mounted and that may result in an app crash if therender
function tries to access uninitialized fields.How did you implement it:
KopytkoUpdater.enqueueStateUpdate
additionally checks if a component is mounted before scheduling state update callbacks.How can we verify it:
Usage:
Kptk.component.xml
Kptk.component.brs
Kptk.template.brs
In this example, calling
setState
will result in an app crash becauserender
refersm.theme
which isinvalid
beforeinitKopytko
is called.Todos:
Is this ready for review?: YES Is it a breaking change?: NO