{"action":"created","issue":{"url":"https://api.github.com/repos/almende/vis/issues/1119","labels_url":"https://api.github.com/repos/almende/vis/issues/1119/labels{/name}","comments_url":"https://api.github.com/repos/almende/vis/issues/1119/comments","events_url":"https://api.github.com/repos/almende/vis/issues/1119/events","html_url":"https://github.com/almende/vis/pull/1119","id":96794865,"number":1119,"title":"Fixed issue where broken images wouldn't always be rendered.","user":{"login":"brendon1982","id":1317688,"avatar_url":"https://avatars.githubusercontent.com/u/1317688?v=3","gravatar_id":"","url":"https://api.github.com/users/brendon1982","html_url":"https://github.com/brendon1982","followers_url":"https://api.github.com/users/brendon1982/followers","following_url":"https://api.github.com/users/brendon1982/following{/other_user}","gists_url":"https://api.github.com/users/brendon1982/gists{/gist_id}","starred_url":"https://api.github.com/users/brendon1982/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendon1982/subscriptions","organizations_url":"https://api.github.com/users/brendon1982/orgs","repos_url":"https://api.github.com/users/brendon1982/repos","events_url":"https://api.github.com/users/brendon1982/events{/privacy}","received_events_url":"https://api.github.com/users/brendon1982/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-23T11:47:32Z","updated_at":"2015-07-23T14:45:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/almende/vis/pulls/1119","html_url":"https://github.com/almende/vis/pull/1119","diff_url":"https://github.com/almende/vis/pull/1119.diff","patch_url":"https://github.com/almende/vis/pull/1119.patch"},"body":"Hi,\r\n\r\nBefore I get into the details of the pull request. I am aware that it is a very heavy handed one. I usually try make as small a change as is necessary to achieve what I need but in this instance I couldn't find a small simple change to solve my problem. I have thoroughly tested my changes in my production project, where I use the broken image feature extensively, as well as all the examples that use images.\r\n\r\nNow to the issue at had. I was having a problem with fall back images where sometimes they wouldn't render. This was quite weird because the problem wasn't that the broken images weren't loading, I confirmed in the browser developer tools that they were loading just fine, I even checked that the 'onload' event was firing for the broken image URL.\r\n\r\nAfter quite a bit of investigation I found that the issue was happening because the 'onerror' event was firing multiple times when the imageUrl failed to load, I confirmed that this was happening even if I only had one node in the network! This caused a problem with the current implementation because it assumed that the first time the 'onerror' event fired that it was a failure for the imageUrl and the second time it fired that it was a failure for the brokenImageUrl and then it cleared the src property of the image, which at that point was set to the brokenImageUrl. I couldn't figure out why the 'onerror' event was firing multiple times, it wasn't because the load function was being called multiple times, or because the src property of the image was being set multiple times. So I decided to update the implementation to use a different function to handle errors in loading brokenImageUrl to errors in loading imageUrl, this removed the complexity of needing to figure out which URL had failed to load, and made the event being raised multiple times a non issue.\r\n\r\nI am aware that the new implementation doesn't use the 'id' parameter that was introduced to fix issue #861, but I have tested this scenario with the new implementation and it works perfectly.\r\n\r\nFinally thanks for the great library and for all the effort you put into it."},"comment":{"url":"https://api.github.com/repos/almende/vis/issues/comments/124129134","html_url":"https://github.com/almende/vis/pull/1119#issuecomment-124129134","issue_url":"https://api.github.com/repos/almende/vis/issues/1119","id":124129134,"user":{"login":"AlexDM0","id":5363277,"avatar_url":"https://avatars.githubusercontent.com/u/5363277?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexDM0","html_url":"https://github.com/AlexDM0","followers_url":"https://api.github.com/users/AlexDM0/followers","following_url":"https://api.github.com/users/AlexDM0/following{/other_user}","gists_url":"https://api.github.com/users/AlexDM0/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexDM0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexDM0/subscriptions","organizations_url":"https://api.github.com/users/AlexDM0/orgs","repos_url":"https://api.github.com/users/AlexDM0/repos","events_url":"https://api.github.com/users/AlexDM0/events{/privacy}","received_events_url":"https://api.github.com/users/AlexDM0/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T14:45:37Z","updated_at":"2015-07-23T14:45:37Z","body":"Hi Brendon,\r\n\r\nES 6 is easy to work with isnt it? :)\r\n\r\ndo we need to update the import lines in the modules that use it? \r\n\r\nThanks for doing all this!"}}