{"action":"created","issue":{"url":"https://api.github.com/repos/omniscientjs/omniscient/issues/93","labels_url":"https://api.github.com/repos/omniscientjs/omniscient/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/omniscientjs/omniscient/issues/93/comments","events_url":"https://api.github.com/repos/omniscientjs/omniscient/issues/93/events","html_url":"https://github.com/omniscientjs/omniscient/issues/93","id":63108286,"number":93,"title":"Reagent style approach / forceUpdateOnState - experimental mixin","user":{"login":"andrewluetgers","id":232036,"avatar_url":"https://avatars.githubusercontent.com/u/232036?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewluetgers","html_url":"https://github.com/andrewluetgers","followers_url":"https://api.github.com/users/andrewluetgers/followers","following_url":"https://api.github.com/users/andrewluetgers/following{/other_user}","gists_url":"https://api.github.com/users/andrewluetgers/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewluetgers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewluetgers/subscriptions","organizations_url":"https://api.github.com/users/andrewluetgers/orgs","repos_url":"https://api.github.com/users/andrewluetgers/repos","events_url":"https://api.github.com/users/andrewluetgers/events{/privacy}","received_events_url":"https://api.github.com/users/andrewluetgers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-19T22:43:22Z","updated_at":"2015-03-20T14:55:42Z","closed_at":null,"body":"Just posting this here for comment/feedback on the idea. I recently read about [Reagent](https://github.com/reagent-project/reagent) and the differences with Om. [Om No! Trouble in paradise with ClojureScript and React.js](http://getprismatic.com/story/1413760839515) \r\n\r\nThis was the titular paragraph.\r\n> Components work best when they know as little data as possible. That way, unnecessary rerendering doesn't have to occur. Om is a very poor fit for this since: (1) app state is in a tree and you need knowledgeof the lowest common ancestor of all the data you need and (2) parents must depend on everything all their children depend on. This results in either (1) the same data in multiple places or (2) a performance hit. This problem was a killer. It was hard to be consistent. It was hard to be performant. We were about to implement a DAG that automatically reconstructs an app state tree by denormalizing ground-truth data when the data changes, but then we discovered that is exactly how Reagent works.\r\n \r\n\r\nThis got me thinking and so I whipped up a quick experiment to see if I could make omniscient render each component individually based on its own reference cursors rather than top-down.\r\n\r\n[https://gist.github.com/andrewluetgers/7768f74f9b2f2ae8730a](https://gist.github.com/andrewluetgers/7768f74f9b2f2ae8730a)\r\n\r\nThis approach works and could be useful if you wanted to avoid causing all the parents to render when a child updates. Potentially animation and complex views that are expensive to update may benefit. But this could be complicated and messy to pull off. There could be problems with cyclical behavior. In my testing I removed the usual top down cursor passing, commented out this line\r\n\r\n    //appState.on('next-animation-frame', function() {render()})\r\n\r\nand just followed the approach as shown in the gist example for all components. I'm curious what others think about this and what Reagent is doing in general."},"comment":{"url":"https://api.github.com/repos/omniscientjs/omniscient/issues/comments/84036856","html_url":"https://github.com/omniscientjs/omniscient/issues/93#issuecomment-84036856","issue_url":"https://api.github.com/repos/omniscientjs/omniscient/issues/93","id":84036856,"user":{"login":"jeffbski","id":5689,"avatar_url":"https://avatars.githubusercontent.com/u/5689?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffbski","html_url":"https://github.com/jeffbski","followers_url":"https://api.github.com/users/jeffbski/followers","following_url":"https://api.github.com/users/jeffbski/following{/other_user}","gists_url":"https://api.github.com/users/jeffbski/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbski/subscriptions","organizations_url":"https://api.github.com/users/jeffbski/orgs","repos_url":"https://api.github.com/users/jeffbski/repos","events_url":"https://api.github.com/users/jeffbski/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbski/received_events","type":"User","site_admin":false},"created_at":"2015-03-20T14:55:42Z","updated_at":"2015-03-20T14:55:42Z","body":"@andrewluetgers Yes, you can definitely use reference cursors to bypass passing everything down through the top. \r\n\r\nI use getChildContext to provide reference cursors down to descendants. Then in the descendant that uses it, subscribe to the updates using setState or forceUpdate to trigger the update on change.\r\n\r\nSo that is a viable option if you don't want to just pass down everything from the top. "}}