{"action":"created","issue":{"url":"https://api.github.com/repos/DevExpress/devextreme-reactive/issues/396","repository_url":"https://api.github.com/repos/DevExpress/devextreme-reactive","labels_url":"https://api.github.com/repos/DevExpress/devextreme-reactive/issues/396/labels{/name}","comments_url":"https://api.github.com/repos/DevExpress/devextreme-reactive/issues/396/comments","events_url":"https://api.github.com/repos/DevExpress/devextreme-reactive/issues/396/events","html_url":"https://github.com/DevExpress/devextreme-reactive/issues/396","id":264569608,"number":396,"title":"High Performance Live Updates & Redux/Immutability","user":{"login":"DanHarman","id":1155948,"avatar_url":"https://avatars2.githubusercontent.com/u/1155948?v=4","gravatar_id":"","url":"https://api.github.com/users/DanHarman","html_url":"https://github.com/DanHarman","followers_url":"https://api.github.com/users/DanHarman/followers","following_url":"https://api.github.com/users/DanHarman/following{/other_user}","gists_url":"https://api.github.com/users/DanHarman/gists{/gist_id}","starred_url":"https://api.github.com/users/DanHarman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanHarman/subscriptions","organizations_url":"https://api.github.com/users/DanHarman/orgs","repos_url":"https://api.github.com/users/DanHarman/repos","events_url":"https://api.github.com/users/DanHarman/events{/privacy}","received_events_url":"https://api.github.com/users/DanHarman/received_events","type":"User","site_admin":false},"labels":[{"id":562812862,"url":"https://api.github.com/repos/DevExpress/devextreme-reactive/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-10-11T12:37:39Z","updated_at":"2017-11-20T19:28:58Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nDo you have a recommended approach for frequent live updates to a large number of rows? e.g. live stock price updates for several thousand rows?\r\n\r\nThe recommended approach from Dan Abramov is to make the store fully normalised e.g.:\r\n\r\n```\r\n{\r\n    images : {\r\n        byId : {\r\n            \"1234\" : { _id: '1234', path: '/path/to/image1234.jpg', thumb: '/path/to/thumb1234.jpg' },\r\n            \"1235\" : { _id: '1235', path: '/path/to/image1235.jpg', thumb: '/path/to/thumb1235.jpg' },\r\n        },\r\n        allImages : [\"1234\", \"1235\"],\r\n    },\r\n}\r\n```\r\ni.e. separating out the list of item from the items. themselves The principal being that if you are binding a grid then the grid component would be `connect`ed to `allImages` and then each visible row component would be `connect`ed to the store directly so they can do a cheap reference comparison of their row data to detect changes to their particular entity via `mapStateToProps`. This means the grid only needs to consider rows that have changed rather than all rows.\r\n\r\n e.g.: (and excuse the data model change, I'm pasting from differing examples)\r\n\r\n```\r\nconst makeMapStateToProps = (initialState, initialProps) => {\r\n  const { id } = initialProps\r\n  const mapStateToProps = (state) => {\r\n    const { todos } = state\r\n    const todo = todos.byId[id]\r\n    const relatedTodo = todo.relatedId && todos.byId[todo.relatedId]\r\n    return {\r\n      todo,\r\n      relatedTodo\r\n    }\r\n  }\r\n  return mapStateToProps\r\n}\r\n\r\nexport default connect(\r\n  makeMapStateToProps\r\n)(TodoItem)\r\n```\r\n\r\nThis is more fully explained here https://github.com/reactjs/redux/issues/1751 and a fuller example can be found here: https://github.com/mweststrate/redux-todomvc. These are where I lifted the example code from.\r\n\r\nAnyway in the context of your ReactGrid, I don't really see how to use this approach since there doesn't appear to be a row component to connect, so I would have to modify the rows property every time. This would seem to imply you need to do a list comparison on every update which is going to be expensive.\r\n\r\nThoughts and recommendations much appreciated. At the very least, is there a way to efficiently communicate a row update to the grid?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/DevExpress/devextreme-reactive/issues/comments/345802727","html_url":"https://github.com/DevExpress/devextreme-reactive/issues/396#issuecomment-345802727","issue_url":"https://api.github.com/repos/DevExpress/devextreme-reactive/issues/396","id":345802727,"user":{"login":"KJoyner","id":784117,"avatar_url":"https://avatars1.githubusercontent.com/u/784117?v=4","gravatar_id":"","url":"https://api.github.com/users/KJoyner","html_url":"https://github.com/KJoyner","followers_url":"https://api.github.com/users/KJoyner/followers","following_url":"https://api.github.com/users/KJoyner/following{/other_user}","gists_url":"https://api.github.com/users/KJoyner/gists{/gist_id}","starred_url":"https://api.github.com/users/KJoyner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KJoyner/subscriptions","organizations_url":"https://api.github.com/users/KJoyner/orgs","repos_url":"https://api.github.com/users/KJoyner/repos","events_url":"https://api.github.com/users/KJoyner/events{/privacy}","received_events_url":"https://api.github.com/users/KJoyner/received_events","type":"User","site_admin":false},"created_at":"2017-11-20T19:28:58Z","updated_at":"2017-11-20T19:28:58Z","author_association":"NONE","body":"I had trouble with the solution as written when a row went into editing mode. The getCellValue method is being called with the row data flattened which caused the id to be an array of characters. I was able to work around this by actually making the row data be an array of { id: id, data: data } where data is a structure containing my row data. In this case, I didn't need the map since the row being passed in also contained the row data. "}}
{"actor":{"display_login":"KJoyner"}}