{"action":"created","issue":{"url":"https://api.github.com/repos/domvm/domvm/issues/204","repository_url":"https://api.github.com/repos/domvm/domvm","labels_url":"https://api.github.com/repos/domvm/domvm/issues/204/labels{/name}","comments_url":"https://api.github.com/repos/domvm/domvm/issues/204/comments","events_url":"https://api.github.com/repos/domvm/domvm/issues/204/events","html_url":"https://github.com/domvm/domvm/issues/204","id":384447390,"node_id":"MDU6SXNzdWUzODQ0NDczOTA=","number":204,"title":"For values returned from diff(), null === {}","user":{"login":"jlgrall","id":1263537,"node_id":"MDQ6VXNlcjEyNjM1Mzc=","avatar_url":"https://avatars2.githubusercontent.com/u/1263537?v=4","gravatar_id":"","url":"https://api.github.com/users/jlgrall","html_url":"https://github.com/jlgrall","followers_url":"https://api.github.com/users/jlgrall/followers","following_url":"https://api.github.com/users/jlgrall/following{/other_user}","gists_url":"https://api.github.com/users/jlgrall/gists{/gist_id}","starred_url":"https://api.github.com/users/jlgrall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlgrall/subscriptions","organizations_url":"https://api.github.com/users/jlgrall/orgs","repos_url":"https://api.github.com/users/jlgrall/repos","events_url":"https://api.github.com/users/jlgrall/events{/privacy}","received_events_url":"https://api.github.com/users/jlgrall/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2018-11-26T18:03:30Z","updated_at":"2018-11-30T23:11:10Z","closed_at":"2018-11-30T23:11:10Z","author_association":"NONE","body":"The code responsible for this is in [`vm.diff.cmp`](https://github.com/domvm/domvm/blob/3.4.6/src/view/ViewModel.js#L73). And it is executed during [`redrawSync()`](https://github.com/domvm/domvm/blob/3.4.6/src/view/ViewModel.js#L252).\r\n\r\nSmall test:\r\n\r\n```javascript\r\n// Dummy vm for testing:\r\nvar vm = domvm.createView({render: function() {}});\r\nvm.config({diff: function() {return 0;}});\r\n\r\n// The comparison function that compares successive values returned by diff()\r\n// doesn't differentiate between null and {}:\r\nconsole.log(\"null === {}:\", vm.diff.cmp(vm, null, {}));      // => false\r\nconsole.log(\"null === null:\", vm.diff.cmp(vm, null, null));  // => false\r\n\r\n// It is actually the same problem for any primitive value:\r\nconsole.log(\"12 === 34:\", vm.diff.cmp(vm, 12, 34));    // => false\r\nconsole.log(\"12 === 12:\", vm.diff.cmp(vm, 12, 12));    // => false\r\n```"},"comment":{"url":"https://api.github.com/repos/domvm/domvm/issues/comments/443367666","html_url":"https://github.com/domvm/domvm/issues/204#issuecomment-443367666","issue_url":"https://api.github.com/repos/domvm/domvm/issues/204","id":443367666,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzM2NzY2Ng==","user":{"login":"leeoniya","id":43234,"node_id":"MDQ6VXNlcjQzMjM0","avatar_url":"https://avatars2.githubusercontent.com/u/43234?v=4","gravatar_id":"","url":"https://api.github.com/users/leeoniya","html_url":"https://github.com/leeoniya","followers_url":"https://api.github.com/users/leeoniya/followers","following_url":"https://api.github.com/users/leeoniya/following{/other_user}","gists_url":"https://api.github.com/users/leeoniya/gists{/gist_id}","starred_url":"https://api.github.com/users/leeoniya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leeoniya/subscriptions","organizations_url":"https://api.github.com/users/leeoniya/orgs","repos_url":"https://api.github.com/users/leeoniya/repos","events_url":"https://api.github.com/users/leeoniya/events{/privacy}","received_events_url":"https://api.github.com/users/leeoniya/received_events","type":"User","site_admin":false},"created_at":"2018-11-30T23:11:10Z","updated_at":"2018-11-30T23:11:10Z","author_association":"COLLABORATOR","body":"> In your <span>#</span>1, the `o == null` is not needed: if `o` is `null`, it will fallthrough the following tests and return `false`. \r\n\r\nthat's technically true, but i'd rather return as early as possible if `o == null && n != null`, otherwise we end up with an extra `isArray(o)` and `isPlainObj(o)`. for the other cases, you only incur an extra cheap null check.\r\n\r\nif you want stricter handling, there's always `{val, eq}` ;)\r\n\r\nthanks for the feedback."}}
{"actor":{"display_login":"leeoniya"}}