{"action":"created","issue":{"url":"https://api.github.com/repos/automerge/automerge/issues/98","repository_url":"https://api.github.com/repos/automerge/automerge","labels_url":"https://api.github.com/repos/automerge/automerge/issues/98/labels{/name}","comments_url":"https://api.github.com/repos/automerge/automerge/issues/98/comments","events_url":"https://api.github.com/repos/automerge/automerge/issues/98/events","html_url":"https://github.com/automerge/automerge/issues/98","id":332996023,"node_id":"MDU6SXNzdWUzMzI5OTYwMjM=","number":98,"title":"Is this expected behavior?","user":{"login":"coodoo","id":325936,"node_id":"MDQ6VXNlcjMyNTkzNg==","avatar_url":"https://avatars3.githubusercontent.com/u/325936?v=4","gravatar_id":"","url":"https://api.github.com/users/coodoo","html_url":"https://github.com/coodoo","followers_url":"https://api.github.com/users/coodoo/followers","following_url":"https://api.github.com/users/coodoo/following{/other_user}","gists_url":"https://api.github.com/users/coodoo/gists{/gist_id}","starred_url":"https://api.github.com/users/coodoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coodoo/subscriptions","organizations_url":"https://api.github.com/users/coodoo/orgs","repos_url":"https://api.github.com/users/coodoo/repos","events_url":"https://api.github.com/users/coodoo/events{/privacy}","received_events_url":"https://api.github.com/users/coodoo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-16T15:50:44Z","updated_at":"2018-06-17T11:01:31Z","closed_at":null,"author_association":"NONE","body":"In short, I created two docs namely `doc1` and `doc2`, then `doc2` deleted the first item in the list, while `doc1` changed the value of the first item, I was expecting the final list should be empty but instead got one item of value 'dd' inside, wondering is this expected result of the merge algorithm?\r\n\r\n```js\r\nconsole.clear()\r\nconst A = require('automerge')\r\n\r\nlet doc1 = A.init('DOC_1')\r\n\r\ndoc1 = A.change( doc1, '', doc => {\r\n\tdoc.foo = ['a']\r\n})\r\n\r\nlet doc2 = A.init('DOC_2')\r\ndoc2 = A.merge(doc2, doc1)\r\n\r\ndoc2 = A.change( doc2, '', doc => {\r\n\tdoc.foo[0] = 'dd'\r\n})\r\n\r\ndoc1 = A.change( doc1, '', doc => {\r\n\tdelete doc.foo[0]\r\n})\r\n\r\n// Expect an empty array, but got ['dd']\r\nlet truthA = A.merge( doc1, doc2 )\r\n// let truthB = A.merge( doc2, doc1 )\r\n\r\nA.getHistory(doc2).map( s => console.log(s.change))\r\n// console.log( '\\n' )\r\nA.getHistory(truthA).map( s => console.log(s.change))\r\n```"},"comment":{"url":"https://api.github.com/repos/automerge/automerge/issues/comments/397870979","html_url":"https://github.com/automerge/automerge/issues/98#issuecomment-397870979","issue_url":"https://api.github.com/repos/automerge/automerge/issues/98","id":397870979,"node_id":"MDEyOklzc3VlQ29tbWVudDM5Nzg3MDk3OQ==","user":{"login":"coodoo","id":325936,"node_id":"MDQ6VXNlcjMyNTkzNg==","avatar_url":"https://avatars3.githubusercontent.com/u/325936?v=4","gravatar_id":"","url":"https://api.github.com/users/coodoo","html_url":"https://github.com/coodoo","followers_url":"https://api.github.com/users/coodoo/followers","following_url":"https://api.github.com/users/coodoo/following{/other_user}","gists_url":"https://api.github.com/users/coodoo/gists{/gist_id}","starred_url":"https://api.github.com/users/coodoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coodoo/subscriptions","organizations_url":"https://api.github.com/users/coodoo/orgs","repos_url":"https://api.github.com/users/coodoo/repos","events_url":"https://api.github.com/users/coodoo/events{/privacy}","received_events_url":"https://api.github.com/users/coodoo/received_events","type":"User","site_admin":false},"created_at":"2018-06-17T11:01:31Z","updated_at":"2018-06-17T11:01:31Z","author_association":"NONE","body":"Interesting, I thought the order of execution from both docs will be considered when materializing the final view, in this case since doc1 deleted foo[0] at the last step, I would expect the final merged result is an empty array?\r\n\r\nOr asked in another way, what operation and when will cause foo[0] be deleted?"}}
{"actor":{"display_login":"coodoo"}}