{"action":"created","issue":{"url":"https://api.github.com/repos/meteor/data/issues/8","repository_url":"https://api.github.com/repos/meteor/data","labels_url":"https://api.github.com/repos/meteor/data/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/meteor/data/issues/8/comments","events_url":"https://api.github.com/repos/meteor/data/issues/8/events","html_url":"https://github.com/meteor/data/pull/8","id":132493065,"number":8,"title":"High-level design for reactive GraphQL","user":{"login":"stubailo","id":448783,"avatar_url":"https://avatars.githubusercontent.com/u/448783?v=3","gravatar_id":"","url":"https://api.github.com/users/stubailo","html_url":"https://github.com/stubailo","followers_url":"https://api.github.com/users/stubailo/followers","following_url":"https://api.github.com/users/stubailo/following{/other_user}","gists_url":"https://api.github.com/users/stubailo/gists{/gist_id}","starred_url":"https://api.github.com/users/stubailo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stubailo/subscriptions","organizations_url":"https://api.github.com/users/stubailo/orgs","repos_url":"https://api.github.com/users/stubailo/repos","events_url":"https://api.github.com/users/stubailo/events{/privacy}","received_events_url":"https://api.github.com/users/stubailo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"stubailo","id":448783,"avatar_url":"https://avatars.githubusercontent.com/u/448783?v=3","gravatar_id":"","url":"https://api.github.com/users/stubailo","html_url":"https://github.com/stubailo","followers_url":"https://api.github.com/users/stubailo/followers","following_url":"https://api.github.com/users/stubailo/following{/other_user}","gists_url":"https://api.github.com/users/stubailo/gists{/gist_id}","starred_url":"https://api.github.com/users/stubailo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stubailo/subscriptions","organizations_url":"https://api.github.com/users/stubailo/orgs","repos_url":"https://api.github.com/users/stubailo/repos","events_url":"https://api.github.com/users/stubailo/events{/privacy}","received_events_url":"https://api.github.com/users/stubailo/received_events","type":"User","site_admin":false},"milestone":null,"comments":24,"created_at":"2016-02-09T18:21:43Z","updated_at":"2016-02-11T01:26:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/meteor/data/pulls/8","html_url":"https://github.com/meteor/data/pull/8","diff_url":"https://github.com/meteor/data/pull/8.diff","patch_url":"https://github.com/meteor/data/pull/8.patch"},"body":"This is a PR so that people can **comment line-by-line** on the individual points.\r\n\r\n**Read the document here: https://github.com/meteor/data/blob/design-overview/design/high-level-reactivity.md**\r\n\r\nThis is the most basic overview of the design, and outlines the core of the system which will allow us to build all kinds of nice wrappers and developer experience on top of itself. Hope this is exciting for people, and you can imagine how this might translate to a really great way to build apps!\r\n\r\nMore designs are coming as we become more confident around the overall plan. This will include a more detailed analysis about how exactly to send and refetch invalidated data with Relay.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/meteor/data/issues/comments/182667396","html_url":"https://github.com/meteor/data/pull/8#issuecomment-182667396","issue_url":"https://api.github.com/repos/meteor/data/issues/8","id":182667396,"user":{"login":"stubailo","id":448783,"avatar_url":"https://avatars.githubusercontent.com/u/448783?v=3","gravatar_id":"","url":"https://api.github.com/users/stubailo","html_url":"https://github.com/stubailo","followers_url":"https://api.github.com/users/stubailo/followers","following_url":"https://api.github.com/users/stubailo/following{/other_user}","gists_url":"https://api.github.com/users/stubailo/gists{/gist_id}","starred_url":"https://api.github.com/users/stubailo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stubailo/subscriptions","organizations_url":"https://api.github.com/users/stubailo/orgs","repos_url":"https://api.github.com/users/stubailo/repos","events_url":"https://api.github.com/users/stubailo/events{/privacy}","received_events_url":"https://api.github.com/users/stubailo/received_events","type":"User","site_admin":false},"created_at":"2016-02-11T01:26:48Z","updated_at":"2016-02-11T01:26:48Z","body":"> Someplace it would need to be defined how to turn that 'string key' into a query.\r\n\r\nI disagree, and I think this is the core difference between this and subscriptions. Let's look at the notification example, and take two possible queries a client might do:\r\n\r\n```\r\n// query 1, for a notification popup\r\nme {\r\n  avatarUrl,\r\n  notifications {\r\n    date,\r\n    text,\r\n    thumbnailUrl,\r\n    linkUrl\r\n  }\r\n}\r\n\r\n// query 2, for a notification page\r\nme {\r\n  firstName,\r\n  notificationCount,\r\n  notifications {\r\n    date,\r\n    story {\r\n      author {\r\n        name\r\n      },\r\n      imageUrl,\r\n      content\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nLet's say you get the following responses back:\r\n\r\n```\r\n// for query 1\r\n{\r\n  me: {\r\n    notifications: [ ... ],\r\n    __deps: { notifications: { \"notificationCount:myUserId\", version: 72 } }\r\n  }\r\n}\r\n\r\n// for query 2\r\n{\r\n  me: {\r\n    notifications: [ ... ],\r\n    __deps: { notifications: { \"notificationCount:myUserId\", version: 72 } }\r\n}\r\n```\r\n\r\nNow, you get an invalidation for the key `\"notificationCount:myUserId\"`. You need to refetch _two different queries_, because they requested different subtrees of information. I won't reproduce them here because they look similar to the above.\r\n\r\nSo the key doesn't at map to a specific query. Because for the same key, depending on what you queried on the client, you get different refetches.\r\n"}}