While working on #21 I found that the selectStateProps functions that are passed to useSelector, currently, get executed twice for each relevant key change. This is due to useSelector (which is already reading state using useState) always calling it once and the callback given to the store proxy calling it to detect changes; if changes are found, the callback sets the state resulting in the entire selectStateProps function to be executed again.
This should be fixed such that for each relevant store key change, selectStateProps is only called once.
The impact is probably not that huge since the return value of the two selectStateProps calls will always be the same, causing React to only trigger (at most) one rerender.
While working on #21 I found that the
selectStatePropsfunctions that are passed touseSelector, currently, get executed twice for each relevant key change. This is due touseSelector(which is already reading state usinguseState) always calling it once and the callback given to the store proxy calling it to detect changes; if changes are found, the callback sets the state resulting in the entireselectStatePropsfunction to be executed again.This should be fixed such that for each relevant store key change,
selectStatePropsis only called once.The impact is probably not that huge since the return value of the two
selectStatePropscalls will always be the same, causing React to only trigger (at most) one rerender.