snap-state
snap-state copied to clipboard
hoc property messed
On the latest version update the logic on the hook should have also been implemented in the hoc.
the properties merged aren't correct.
if a component is listening to changes in multiple objects either by HOC, VANILLA, or HOOK
when a prop changes it should also return the other properties being listen to. prior to version 1.1.7 the properties would be called one by one, resulting in undefined.
// set random state
State.test1 = 1;
State.test2 = 2;
// when a listener is like this
const { test1, test2 } = useSnapState(['test1', 'test2']);
// and a property change happens to only
State.test1 = 'test1';
// the response is:
test1 = 'test1'
test2 = undefined;
// what it should be is
test1 = 'test1'
test2 = 2;
// so all listened properties should return.
It seems to be fixes on the hook, but not on the HOC