{"action":"created","comment":{"url":"https://api.github.com/repos/mweststrate/immer/pulls/comments/211133479","pull_request_review_id":147492115,"id":211133479,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTEzMzQ3OQ==","diff_hunk":"@@ -125,15 +141,7 @@ export function applyPatches(draft, patches) {\n                     base[key] = patch.value\n                     break\n                 case \"remove\":\n-                    if (Array.isArray(base)) {","path":"src/patches.js","position":53,"original_position":53,"commit_id":"52b003979c14bb0d07a29a733387c749f6dac23e","original_commit_id":"52b003979c14bb0d07a29a733387c749f6dac23e","user":{"login":"luruozhou","id":10755486,"node_id":"MDQ6VXNlcjEwNzU1NDg2","avatar_url":"https://avatars3.githubusercontent.com/u/10755486?v=4","gravatar_id":"","url":"https://api.github.com/users/luruozhou","html_url":"https://github.com/luruozhou","followers_url":"https://api.github.com/users/luruozhou/followers","following_url":"https://api.github.com/users/luruozhou/following{/other_user}","gists_url":"https://api.github.com/users/luruozhou/gists{/gist_id}","starred_url":"https://api.github.com/users/luruozhou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luruozhou/subscriptions","organizations_url":"https://api.github.com/users/luruozhou/orgs","repos_url":"https://api.github.com/users/luruozhou/repos","events_url":"https://api.github.com/users/luruozhou/events{/privacy}","received_events_url":"https://api.github.com/users/luruozhou/received_events","type":"User","site_admin":false},"body":"In both proxy and es5 mode, when delete an array item wont't cause any error, unless calling applyPatches with the patches. I think it's better to use the patches to replay the actions","created_at":"2018-08-20T03:25:43Z","updated_at":"2018-08-20T03:25:43Z","html_url":"https://github.com/mweststrate/immer/pull/173#discussion_r211133479","pull_request_url":"https://api.github.com/repos/mweststrate/immer/pulls/173","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/mweststrate/immer/pulls/comments/211133479"},"html":{"href":"https://github.com/mweststrate/immer/pull/173#discussion_r211133479"},"pull_request":{"href":"https://api.github.com/repos/mweststrate/immer/pulls/173"}},"in_reply_to_id":210637941},"pull_request":{"url":"https://api.github.com/repos/mweststrate/immer/pulls/173","id":207869720,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3ODY5NzIw","html_url":"https://github.com/mweststrate/immer/pull/173","diff_url":"https://github.com/mweststrate/immer/pull/173.diff","patch_url":"https://github.com/mweststrate/immer/pull/173.patch","issue_url":"https://api.github.com/repos/mweststrate/immer/issues/173","number":173,"state":"open","locked":false,"title":"Fix/es5 array delete error","user":{"login":"luruozhou","id":10755486,"node_id":"MDQ6VXNlcjEwNzU1NDg2","avatar_url":"https://avatars3.githubusercontent.com/u/10755486?v=4","gravatar_id":"","url":"https://api.github.com/users/luruozhou","html_url":"https://github.com/luruozhou","followers_url":"https://api.github.com/users/luruozhou/followers","following_url":"https://api.github.com/users/luruozhou/following{/other_user}","gists_url":"https://api.github.com/users/luruozhou/gists{/gist_id}","starred_url":"https://api.github.com/users/luruozhou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luruozhou/subscriptions","organizations_url":"https://api.github.com/users/luruozhou/orgs","repos_url":"https://api.github.com/users/luruozhou/repos","events_url":"https://api.github.com/users/luruozhou/events{/privacy}","received_events_url":"https://api.github.com/users/luruozhou/received_events","type":"User","site_admin":false},"body":"when delete array items in using es5 mode, the produce doesn't work.\r\n\r\nfor example:\r\n\r\n```\r\n   let base = [1,2,3];\r\n   let changes = []\r\n   let inverseChanges = []\r\n\r\n   let fork = produce(\r\n       base,\r\n       draft => {\r\n           delete draft[1];\r\n       },\r\n       (patches, inversePatches) => {\r\n           console.log(patches,inversePatches)\r\n           changes.push(...patches)\r\n           inverseChanges.push(...inversePatches)\r\n       }\r\n   )\r\n   console.log(fork, fork === base, changes, inverseChanges) // [1,2,3]  true [] []\r\n```\r\n\r\nfinally,we get that fork is the same reference with  base, the same time we get that the length of patches and inversePatches is zero.","created_at":"2018-08-13T04:54:36Z","updated_at":"2018-08-20T03:25:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6ee748b8815b0501d32046a0b14ce52df594e1ff","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mweststrate/immer/pulls/173/commits","review_comments_url":"https://api.github.com/repos/mweststrate/immer/pulls/173/comments","review_comment_url":"https://api.github.com/repos/mweststrate/immer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mweststrate/immer/issues/173/comments","statuses_url":"https://api.github.com/repos/mweststrate/immer/statuses/52b003979c14bb0d07a29a733387c749f6dac23e","head":{"label":"luruozhou:fix/es5-array-delete-error","ref":"fix/es5-array-delete-error","sha":"52b003979c14bb0d07a29a733387c749f6dac23e","user":{"login":"luruozhou","id":10755486,"node_id":"MDQ6VXNlcjEwNzU1NDg2","avatar_url":"https://avatars3.githubusercontent.com/u/10755486?v=4","gravatar_id":"","url":"https://api.github.com/users/luruozhou","html_url":"https://github.com/luruozhou","followers_url":"https://api.github.com/users/luruozhou/followers","following_url":"https://api.github.com/users/luruozhou/following{/other_user}","gists_url":"https://api.github.com/users/luruozhou/gists{/gist_id}","starred_url":"https://api.github.com/users/luruozhou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luruozhou/subscriptions","organizations_url":"https://api.github.com/users/luruozhou/orgs","repos_url":"https://api.github.com/users/luruozhou/repos","events_url":"https://api.github.com/users/luruozhou/events{/privacy}","received_events_url":"https://api.github.com/users/luruozhou/received_events","type":"User","site_admin":false},"repo":{"id":143829810,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM4Mjk4MTA=","name":"immer","full_name":"luruozhou/immer","owner":{"login":"luruozhou","id":10755486,"node_id":"MDQ6VXNlcjEwNzU1NDg2","avatar_url":"https://avatars3.githubusercontent.com/u/10755486?v=4","gravatar_id":"","url":"https://api.github.com/users/luruozhou","html_url":"https://github.com/luruozhou","followers_url":"https://api.github.com/users/luruozhou/followers","following_url":"https://api.github.com/users/luruozhou/following{/other_user}","gists_url":"https://api.github.com/users/luruozhou/gists{/gist_id}","starred_url":"https://api.github.com/users/luruozhou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luruozhou/subscriptions","organizations_url":"https://api.github.com/users/luruozhou/orgs","repos_url":"https://api.github.com/users/luruozhou/repos","events_url":"https://api.github.com/users/luruozhou/events{/privacy}","received_events_url":"https://api.github.com/users/luruozhou/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/luruozhou/immer","description":"Create the next immutable state by mutating the current one","fork":true,"url":"https://api.github.com/repos/luruozhou/immer","forks_url":"https://api.github.com/repos/luruozhou/immer/forks","keys_url":"https://api.github.com/repos/luruozhou/immer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/luruozhou/immer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/luruozhou/immer/teams","hooks_url":"https://api.github.com/repos/luruozhou/immer/hooks","issue_events_url":"https://api.github.com/repos/luruozhou/immer/issues/events{/number}","events_url":"https://api.github.com/repos/luruozhou/immer/events","assignees_url":"https://api.github.com/repos/luruozhou/immer/assignees{/user}","branches_url":"https://api.github.com/repos/luruozhou/immer/branches{/branch}","tags_url":"https://api.github.com/repos/luruozhou/immer/tags","blobs_url":"https://api.github.com/repos/luruozhou/immer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/luruozhou/immer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/luruozhou/immer/git/refs{/sha}","trees_url":"https://api.github.com/repos/luruozhou/immer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/luruozhou/immer/statuses/{sha}","languages_url":"https://api.github.com/repos/luruozhou/immer/languages","stargazers_url":"https://api.github.com/repos/luruozhou/immer/stargazers","contributors_url":"https://api.github.com/repos/luruozhou/immer/contributors","subscribers_url":"https://api.github.com/repos/luruozhou/immer/subscribers","subscription_url":"https://api.github.com/repos/luruozhou/immer/subscription","commits_url":"https://api.github.com/repos/luruozhou/immer/commits{/sha}","git_commits_url":"https://api.github.com/repos/luruozhou/immer/git/commits{/sha}","comments_url":"https://api.github.com/repos/luruozhou/immer/comments{/number}","issue_comment_url":"https://api.github.com/repos/luruozhou/immer/issues/comments{/number}","contents_url":"https://api.github.com/repos/luruozhou/immer/contents/{+path}","compare_url":"https://api.github.com/repos/luruozhou/immer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/luruozhou/immer/merges","archive_url":"https://api.github.com/repos/luruozhou/immer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/luruozhou/immer/downloads","issues_url":"https://api.github.com/repos/luruozhou/immer/issues{/number}","pulls_url":"https://api.github.com/repos/luruozhou/immer/pulls{/number}","milestones_url":"https://api.github.com/repos/luruozhou/immer/milestones{/number}","notifications_url":"https://api.github.com/repos/luruozhou/immer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/luruozhou/immer/labels{/name}","releases_url":"https://api.github.com/repos/luruozhou/immer/releases{/id}","deployments_url":"https://api.github.com/repos/luruozhou/immer/deployments","created_at":"2018-08-07T06:29:45Z","updated_at":"2018-08-07T06:29:47Z","pushed_at":"2018-08-13T04:24:01Z","git_url":"git://github.com/luruozhou/immer.git","ssh_url":"git@github.com:luruozhou/immer.git","clone_url":"https://github.com/luruozhou/immer.git","svn_url":"https://github.com/luruozhou/immer","homepage":"","size":1446,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mweststrate:master","ref":"master","sha":"979d7a34dd0331b5ba44983bf55cc545ad9ea2f4","user":{"login":"mweststrate","id":1820292,"node_id":"MDQ6VXNlcjE4MjAyOTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1820292?v=4","gravatar_id":"","url":"https://api.github.com/users/mweststrate","html_url":"https://github.com/mweststrate","followers_url":"https://api.github.com/users/mweststrate/followers","following_url":"https://api.github.com/users/mweststrate/following{/other_user}","gists_url":"https://api.github.com/users/mweststrate/gists{/gist_id}","starred_url":"https://api.github.com/users/mweststrate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mweststrate/subscriptions","organizations_url":"https://api.github.com/users/mweststrate/orgs","repos_url":"https://api.github.com/users/mweststrate/repos","events_url":"https://api.github.com/users/mweststrate/events{/privacy}","received_events_url":"https://api.github.com/users/mweststrate/received_events","type":"User","site_admin":false},"repo":{"id":115720575,"node_id":"MDEwOlJlcG9zaXRvcnkxMTU3MjA1NzU=","name":"immer","full_name":"mweststrate/immer","owner":{"login":"mweststrate","id":1820292,"node_id":"MDQ6VXNlcjE4MjAyOTI=","avatar_url":"https://avatars0.githubusercontent.com/u/1820292?v=4","gravatar_id":"","url":"https://api.github.com/users/mweststrate","html_url":"https://github.com/mweststrate","followers_url":"https://api.github.com/users/mweststrate/followers","following_url":"https://api.github.com/users/mweststrate/following{/other_user}","gists_url":"https://api.github.com/users/mweststrate/gists{/gist_id}","starred_url":"https://api.github.com/users/mweststrate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mweststrate/subscriptions","organizations_url":"https://api.github.com/users/mweststrate/orgs","repos_url":"https://api.github.com/users/mweststrate/repos","events_url":"https://api.github.com/users/mweststrate/events{/privacy}","received_events_url":"https://api.github.com/users/mweststrate/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mweststrate/immer","description":"Create the next immutable state by mutating the current one","fork":false,"url":"https://api.github.com/repos/mweststrate/immer","forks_url":"https://api.github.com/repos/mweststrate/immer/forks","keys_url":"https://api.github.com/repos/mweststrate/immer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mweststrate/immer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mweststrate/immer/teams","hooks_url":"https://api.github.com/repos/mweststrate/immer/hooks","issue_events_url":"https://api.github.com/repos/mweststrate/immer/issues/events{/number}","events_url":"https://api.github.com/repos/mweststrate/immer/events","assignees_url":"https://api.github.com/repos/mweststrate/immer/assignees{/user}","branches_url":"https://api.github.com/repos/mweststrate/immer/branches{/branch}","tags_url":"https://api.github.com/repos/mweststrate/immer/tags","blobs_url":"https://api.github.com/repos/mweststrate/immer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mweststrate/immer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mweststrate/immer/git/refs{/sha}","trees_url":"https://api.github.com/repos/mweststrate/immer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mweststrate/immer/statuses/{sha}","languages_url":"https://api.github.com/repos/mweststrate/immer/languages","stargazers_url":"https://api.github.com/repos/mweststrate/immer/stargazers","contributors_url":"https://api.github.com/repos/mweststrate/immer/contributors","subscribers_url":"https://api.github.com/repos/mweststrate/immer/subscribers","subscription_url":"https://api.github.com/repos/mweststrate/immer/subscription","commits_url":"https://api.github.com/repos/mweststrate/immer/commits{/sha}","git_commits_url":"https://api.github.com/repos/mweststrate/immer/git/commits{/sha}","comments_url":"https://api.github.com/repos/mweststrate/immer/comments{/number}","issue_comment_url":"https://api.github.com/repos/mweststrate/immer/issues/comments{/number}","contents_url":"https://api.github.com/repos/mweststrate/immer/contents/{+path}","compare_url":"https://api.github.com/repos/mweststrate/immer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mweststrate/immer/merges","archive_url":"https://api.github.com/repos/mweststrate/immer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mweststrate/immer/downloads","issues_url":"https://api.github.com/repos/mweststrate/immer/issues{/number}","pulls_url":"https://api.github.com/repos/mweststrate/immer/pulls{/number}","milestones_url":"https://api.github.com/repos/mweststrate/immer/milestones{/number}","notifications_url":"https://api.github.com/repos/mweststrate/immer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mweststrate/immer/labels{/name}","releases_url":"https://api.github.com/repos/mweststrate/immer/releases{/id}","deployments_url":"https://api.github.com/repos/mweststrate/immer/deployments","created_at":"2017-12-29T12:25:47Z","updated_at":"2018-08-20T03:18:43Z","pushed_at":"2018-08-18T12:40:13Z","git_url":"git://github.com/mweststrate/immer.git","ssh_url":"git@github.com:mweststrate/immer.git","clone_url":"https://github.com/mweststrate/immer.git","svn_url":"https://github.com/mweststrate/immer","homepage":"","size":1475,"stargazers_count":5524,"watchers_count":5524,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":153,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":153,"open_issues":7,"watchers":5524,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mweststrate/immer/pulls/173"},"html":{"href":"https://github.com/mweststrate/immer/pull/173"},"issue":{"href":"https://api.github.com/repos/mweststrate/immer/issues/173"},"comments":{"href":"https://api.github.com/repos/mweststrate/immer/issues/173/comments"},"review_comments":{"href":"https://api.github.com/repos/mweststrate/immer/pulls/173/comments"},"review_comment":{"href":"https://api.github.com/repos/mweststrate/immer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mweststrate/immer/pulls/173/commits"},"statuses":{"href":"https://api.github.com/repos/mweststrate/immer/statuses/52b003979c14bb0d07a29a733387c749f6dac23e"}},"author_association":"NONE"}}
{"actor":{"display_login":"luruozhou"}}