{"action":"created","issue":{"url":"https://api.github.com/repos/gaearon/redux-devtools/issues/28","labels_url":"https://api.github.com/repos/gaearon/redux-devtools/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/gaearon/redux-devtools/issues/28/comments","events_url":"https://api.github.com/repos/gaearon/redux-devtools/issues/28/events","html_url":"https://github.com/gaearon/redux-devtools/issues/28","id":96768475,"number":28,"title":"\"toObject is not a function\" with persistState and Immutable data ","user":{"login":"philholden","id":1674806,"avatar_url":"https://avatars.githubusercontent.com/u/1674806?v=3","gravatar_id":"","url":"https://api.github.com/users/philholden","html_url":"https://github.com/philholden","followers_url":"https://api.github.com/users/philholden/followers","following_url":"https://api.github.com/users/philholden/following{/other_user}","gists_url":"https://api.github.com/users/philholden/gists{/gist_id}","starred_url":"https://api.github.com/users/philholden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philholden/subscriptions","organizations_url":"https://api.github.com/users/philholden/orgs","repos_url":"https://api.github.com/users/philholden/repos","events_url":"https://api.github.com/users/philholden/events{/privacy}","received_events_url":"https://api.github.com/users/philholden/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-23T09:15:18Z","updated_at":"2015-07-23T09:43:41Z","closed_at":"2015-07-23T09:43:41Z","body":"When I use `persistState` and with a debug session and immutable data I get the error below when I reload the page after committing:\r\n\r\n```\r\nUncaught TypeError: campaign.toObject is not a function\r\n```\r\n\r\nMy state is an immutable record.\r\n\r\n```javascript\r\nconst table = Record({\r\n  rows: List([]),\r\n  sortBy: 'name',\r\n  isAsc: false,\r\n  mode: ACTIVE\r\n});\r\n```\r\n\r\nAre there any hooks I can use to turn persisted state back into an immutable record"},"comment":{"url":"https://api.github.com/repos/gaearon/redux-devtools/issues/comments/124035220","html_url":"https://github.com/gaearon/redux-devtools/issues/28#issuecomment-124035220","issue_url":"https://api.github.com/repos/gaearon/redux-devtools/issues/28","id":124035220,"user":{"login":"philholden","id":1674806,"avatar_url":"https://avatars.githubusercontent.com/u/1674806?v=3","gravatar_id":"","url":"https://api.github.com/users/philholden","html_url":"https://github.com/philholden","followers_url":"https://api.github.com/users/philholden/followers","following_url":"https://api.github.com/users/philholden/following{/other_user}","gists_url":"https://api.github.com/users/philholden/gists{/gist_id}","starred_url":"https://api.github.com/users/philholden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philholden/subscriptions","organizations_url":"https://api.github.com/users/philholden/orgs","repos_url":"https://api.github.com/users/philholden/repos","events_url":"https://api.github.com/users/philholden/events{/privacy}","received_events_url":"https://api.github.com/users/philholden/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T09:43:41Z","updated_at":"2015-07-23T09:43:41Z","body":"Ok solved it added toImmutable in my reducer it checks if the current state is a Record and if not converts it to one. \r\n\r\n```javascript\r\nfunction toImmutable(state) {\r\n  if (state instanceof Record) {\r\n    return state;\r\n  } else {\r\n    state.rows = List(state.rows);\r\n    return new Table(state);\r\n  }\r\n}\r\n\r\nexport default function (state = initialState, action) {\r\n  state = toImmutable(state);\r\n  switch (action.type) {\r\n```"}}