{"action":"created","issue":{"url":"https://api.github.com/repos/mattkrick/cashay/issues/127","repository_url":"https://api.github.com/repos/mattkrick/cashay","labels_url":"https://api.github.com/repos/mattkrick/cashay/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/mattkrick/cashay/issues/127/comments","events_url":"https://api.github.com/repos/mattkrick/cashay/issues/127/events","html_url":"https://github.com/mattkrick/cashay/issues/127","id":181055752,"number":127,"title":"remove id from the @cached directive","user":{"login":"mattkrick","id":5514175,"avatar_url":"https://avatars.githubusercontent.com/u/5514175?v=3","gravatar_id":"","url":"https://api.github.com/users/mattkrick","html_url":"https://github.com/mattkrick","followers_url":"https://api.github.com/users/mattkrick/followers","following_url":"https://api.github.com/users/mattkrick/following{/other_user}","gists_url":"https://api.github.com/users/mattkrick/gists{/gist_id}","starred_url":"https://api.github.com/users/mattkrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattkrick/subscriptions","organizations_url":"https://api.github.com/users/mattkrick/orgs","repos_url":"https://api.github.com/users/mattkrick/repos","events_url":"https://api.github.com/users/mattkrick/events{/privacy}","received_events_url":"https://api.github.com/users/mattkrick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-05T03:14:44Z","updated_at":"2016-10-05T18:06:56Z","closed_at":null,"body":"the `id, ids` fields are pretty useless & can use a pre-cached value causing source.id to come up undefined. It's not terrible, but it causes an extra render. Plus this makes for a smaller, more opinionated API. "},"comment":{"url":"https://api.github.com/repos/mattkrick/cashay/issues/comments/251752630","html_url":"https://github.com/mattkrick/cashay/issues/127#issuecomment-251752630","issue_url":"https://api.github.com/repos/mattkrick/cashay/issues/127","id":251752630,"user":{"login":"mattkrick","id":5514175,"avatar_url":"https://avatars.githubusercontent.com/u/5514175?v=3","gravatar_id":"","url":"https://api.github.com/users/mattkrick","html_url":"https://github.com/mattkrick","followers_url":"https://api.github.com/users/mattkrick/followers","following_url":"https://api.github.com/users/mattkrick/following{/other_user}","gists_url":"https://api.github.com/users/mattkrick/gists{/gist_id}","starred_url":"https://api.github.com/users/mattkrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattkrick/subscriptions","organizations_url":"https://api.github.com/users/mattkrick/orgs","repos_url":"https://api.github.com/users/mattkrick/repos","events_url":"https://api.github.com/users/mattkrick/events{/privacy}","received_events_url":"https://api.github.com/users/mattkrick/received_events","type":"User","site_admin":false},"created_at":"2016-10-05T18:06:56Z","updated_at":"2016-10-05T18:06:56Z","body":"Yep! I could probably elucidate this a little better in the docs, but basically each method in `resolveCached` is a function that can return a string, an array of strings, or a function.\r\n\r\nIf it returns a string, in this case `projectId`, it with return `store.getState().cashay.entities[type='Project'][projectId]`.\r\n\r\nNext, look at the `teamMember` method. It also returns a string `source.teamMemberId`. The `source` is the parent object (just like in a GraphQL resolve function). \r\nSo in this case:\r\n```\r\nconst id = `store.getState().cashay.entities[type='Project'][projectId].teamMemberId`\r\nreturn store.getState().cashay.entities[type='TeamMember'][id]\r\n```\r\n\r\nFinally, just like you said, the `team` method returns a function, which will run in O(n) over every single `Team` entity. It returns a single value. For an array of values, the type would be `type: [Team]`. "}}
{"actor":{"display_login":"mattkrick"}}