samiskin / redux-electron-store

⎋ A redux store enhancer that allows automatic synchronization between electron processes
MIT License
375 stars 32 forks source link

Object diff doesn't work at all #55

Closed matt-way closed 6 years ago

matt-way commented 6 years ago

I was subscribing to a store inside a renderer, and was confused that every single action was returning the entire state every time as updated. After digging around in the commit history, I noticed that in the last big refactor (https://github.com/samiskin/redux-electron-store/commit/ff5f9505f646a1a7096997455d8dac4dc5fc10a6#diff-7ab7e09e8edcb2db8578e65e684e3b70), you removed this line from object-difference.js

if (oldValue[key] === newValue[key]) return;

It looks to me like objectDifference has been broken since march last year, unless im missing something. Also noticed no tests on that function. Interestingly this won't break the redux functionality, it'll just send the entire state over ipc for every single action, which could cause performance issues. For me it breaks any ability to do my own diffs with a watcher inside a renderer.

This fiddle showcases it simply: https://jsfiddle.net/tjrwqaom/

samiskin commented 6 years ago

Whoa yeah, must've deleted it by accident, thanks!

samiskin commented 6 years ago

Published your fix in version 0.6.3, thanks so much for contributing! Sorry about the delay