{"action":"created","issue":{"url":"https://api.github.com/repos/omcljs/om/issues/506","labels_url":"https://api.github.com/repos/omcljs/om/issues/506/labels{/name}","comments_url":"https://api.github.com/repos/omcljs/om/issues/506/comments","events_url":"https://api.github.com/repos/omcljs/om/issues/506/events","html_url":"https://github.com/omcljs/om/pull/506","id":119321597,"number":506,"title":"Rewrite of process roots.","user":{"login":"awkay","id":1177083,"avatar_url":"https://avatars.githubusercontent.com/u/1177083?v=3","gravatar_id":"","url":"https://api.github.com/users/awkay","html_url":"https://github.com/awkay","followers_url":"https://api.github.com/users/awkay/followers","following_url":"https://api.github.com/users/awkay/following{/other_user}","gists_url":"https://api.github.com/users/awkay/gists{/gist_id}","starred_url":"https://api.github.com/users/awkay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awkay/subscriptions","organizations_url":"https://api.github.com/users/awkay/orgs","repos_url":"https://api.github.com/users/awkay/repos","events_url":"https://api.github.com/users/awkay/events{/privacy}","received_events_url":"https://api.github.com/users/awkay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-28T22:23:26Z","updated_at":"2015-11-29T23:16:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/omcljs/om/pulls/506","html_url":"https://github.com/omcljs/om/pull/506","diff_url":"https://github.com/omcljs/om/pull/506.diff","patch_url":"https://github.com/omcljs/om/pull/506.patch"},"body":"The new process roots and rewrite functionality has the following behavior (verified by tests):\r\n\r\n- All top-level non-join elements are preserved\r\n- A join down any path that wants to be at the root is promoted to that position in the top level query. Subroots are not scanned (once one is found along a prefix, it is done with that path)\r\n\r\nMajor implications/change:\r\n- The top-level query may expand to include more elements than it started with when a common prefix is eliminated for both queries (this is not subroots, these are roots that branch off at a common parent).\r\n\r\nKnown current weakness:\r\nTwo sub-paths could potentially ask the same basic question (see test-process-roots-can-reroot-same-join-from-multiple-paths), which means the single returned result will get rewritten to more than one path in the result. Unfortunately, they may not have asked exactly the same question and since the result is a map, only one result will come back (and then get rewritten into both places). \r\n\r\nI think this should emit a warning (iff the query has a repeat of a top-level key that does not exactly match the other), but the logger is in the reconciler."},"comment":{"url":"https://api.github.com/repos/omcljs/om/issues/comments/160480417","html_url":"https://github.com/omcljs/om/pull/506#issuecomment-160480417","issue_url":"https://api.github.com/repos/omcljs/om/issues/506","id":160480417,"user":{"login":"awkay","id":1177083,"avatar_url":"https://avatars.githubusercontent.com/u/1177083?v=3","gravatar_id":"","url":"https://api.github.com/users/awkay","html_url":"https://github.com/awkay","followers_url":"https://api.github.com/users/awkay/followers","following_url":"https://api.github.com/users/awkay/following{/other_user}","gists_url":"https://api.github.com/users/awkay/gists{/gist_id}","starred_url":"https://api.github.com/users/awkay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awkay/subscriptions","organizations_url":"https://api.github.com/users/awkay/orgs","repos_url":"https://api.github.com/users/awkay/repos","events_url":"https://api.github.com/users/awkay/events{/privacy}","received_events_url":"https://api.github.com/users/awkay/received_events","type":"User","site_admin":false},"created_at":"2015-11-29T23:16:23Z","updated_at":"2015-11-29T23:16:23Z","body":"OK, after looking at it some more I don't want to split it up into separate queries, because that causes a time-lag between requests such that two things asking for the same basic data (with slight variance) might see inconsistent results (e.g. it has a race condition).\r\n\r\nInstead, I think merging the queries make sense. The only way it can be a root is if the server can resolve the root to specific data, which means that the queries from different parts of the UI really are asking for data about the same objects...just different bits of it. If I merge the collided queries then the server will put \"too much\" data on the result node, and `rewrite-roots` will pepper this \"fat result\" onto places in the tree that asked for less, but the merge gets normalized anyhow, so that collapses this \"fat result\" into the one actual place in state, and the next parse to get UI state will get the correct data for each UI component. Even if the target destinations for the data are not normalizable, it still isn't a big deal...the parse phase should still pare it down to the right stuff.\r\n\r\n"}}