in select function, use a function for setState, since we can potentially return a function ourselves, and it will be automatically executed if we don't use the function format
in combine function, we didn't skip the first call, which caused several setValues to be executed. It wasn't a problem, because it happened right after the state creation in the same CPU cycle, so the state couldn't have any subscriptions, just a small optimization.
Description
Two things:
select
function, use a function forsetState
, since we can potentially return a function ourselves, and it will be automatically executed if we don't use the function formatcombine
function, we didn't skip the first call, which caused severalsetValues
to be executed. It wasn't a problem, because it happened right after the state creation in the same CPU cycle, so the state couldn't have any subscriptions, just a small optimization.