{"action":"created","issue":{"url":"https://api.github.com/repos/ractivejs/ractive/issues/2962","repository_url":"https://api.github.com/repos/ractivejs/ractive","labels_url":"https://api.github.com/repos/ractivejs/ractive/issues/2962/labels{/name}","comments_url":"https://api.github.com/repos/ractivejs/ractive/issues/2962/comments","events_url":"https://api.github.com/repos/ractivejs/ractive/issues/2962/events","html_url":"https://github.com/ractivejs/ractive/issues/2962","id":228515815,"number":2962,"title":"\"keypath cannot be linked to itself\" test should not happen with options.ractive","user":{"login":"paulie4","id":203125,"avatar_url":"https://avatars1.githubusercontent.com/u/203125?v=3","gravatar_id":"","url":"https://api.github.com/users/paulie4","html_url":"https://github.com/paulie4","followers_url":"https://api.github.com/users/paulie4/followers","following_url":"https://api.github.com/users/paulie4/following{/other_user}","gists_url":"https://api.github.com/users/paulie4/gists{/gist_id}","starred_url":"https://api.github.com/users/paulie4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulie4/subscriptions","organizations_url":"https://api.github.com/users/paulie4/orgs","repos_url":"https://api.github.com/users/paulie4/repos","events_url":"https://api.github.com/users/paulie4/events{/privacy}","received_events_url":"https://api.github.com/users/paulie4/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-14T03:31:46Z","updated_at":"2017-05-14T07:43:00Z","closed_at":"2017-05-14T07:29:21Z","body":"## Description:\r\nThe [link() function](https://github.com/ractivejs/ractive/blob/dev/src/Ractive/prototype/link.js) has an error check for \"A keypath cannot be linked to itself,\" but it should not perform this check if options.ractive is passed in, since even though here === there, it's a different data model.\r\n\r\n## Versions affected:\r\nRactive 0.9\r\n\r\n## Platforms affected:\r\nAll\r\n\r\n## Reproduction:\r\nhttps://ractive.js.org/playground/#N4IgFiBcoE5SBTAJgcwSANCAzlA2iCALoC+WukIAbgIYwAE2ALgPYwL0C89AdggO70ASjQDGTAJZUEACmAAdHvKZIaTGpHoKlTZQGsEATwAOasJoDktADYXFykopIBKANz2etBlQkCuvPxFxKVltZQRrSyQpCwx7JiYEAFtjazUESwMTM39gYCzTJjASEjseF0UfAQA6awkePRkLArNY+majQrA24BgxSWlNZjYEF3ceURYebBZrBFqWFCaWoq42qv5qtCZlztbnN0wQJngAHmiqAD5TgHoLy5ASIA\r\n\r\n## Code:\r\nI think the fix should be to change the error logic to be like this (maybe with some line breaks):\r\n```\r\n\tif ( !options.ractive && ( here === there || (there + '.').indexOf( here + '.' ) === 0 || (here + '.').indexOf( there + '.' ) === 0 ) ) {\r\n\t\tthrow new Error( 'A keypath cannot be linked to itself.' );\r\n\t}\r\n```"},"comment":{"url":"https://api.github.com/repos/ractivejs/ractive/issues/comments/301296523","html_url":"https://github.com/ractivejs/ractive/issues/2962#issuecomment-301296523","issue_url":"https://api.github.com/repos/ractivejs/ractive/issues/2962","id":301296523,"user":{"login":"evs-chris","id":161978,"avatar_url":"https://avatars0.githubusercontent.com/u/161978?v=3","gravatar_id":"","url":"https://api.github.com/users/evs-chris","html_url":"https://github.com/evs-chris","followers_url":"https://api.github.com/users/evs-chris/followers","following_url":"https://api.github.com/users/evs-chris/following{/other_user}","gists_url":"https://api.github.com/users/evs-chris/gists{/gist_id}","starred_url":"https://api.github.com/users/evs-chris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evs-chris/subscriptions","organizations_url":"https://api.github.com/users/evs-chris/orgs","repos_url":"https://api.github.com/users/evs-chris/repos","events_url":"https://api.github.com/users/evs-chris/events{/privacy}","received_events_url":"https://api.github.com/users/evs-chris/received_events","type":"User","site_admin":false},"created_at":"2017-05-14T07:43:00Z","updated_at":"2017-05-14T07:43:00Z","body":"Instead of checking the keypath strings, edge will now actually walk the model tree to see if either resolved model is a parent of the other. That should still keep cross instance cycles from forming.\r\n\r\nThanks for the report!"}}
{"actor":{"display_login":"evs-chris"}}