{"action":"opened","issue":{"url":"https://api.github.com/repos/rt2zz/redux-persist/issues/151","repository_url":"https://api.github.com/repos/rt2zz/redux-persist","labels_url":"https://api.github.com/repos/rt2zz/redux-persist/issues/151/labels{/name}","comments_url":"https://api.github.com/repos/rt2zz/redux-persist/issues/151/comments","events_url":"https://api.github.com/repos/rt2zz/redux-persist/issues/151/events","html_url":"https://github.com/rt2zz/redux-persist/issues/151","id":171848758,"number":151,"title":"Reducer changes triggering update of other reducers","user":{"login":"laurmurclar","id":9434500,"avatar_url":"https://avatars.githubusercontent.com/u/9434500?v=3","gravatar_id":"","url":"https://api.github.com/users/laurmurclar","html_url":"https://github.com/laurmurclar","followers_url":"https://api.github.com/users/laurmurclar/followers","following_url":"https://api.github.com/users/laurmurclar/following{/other_user}","gists_url":"https://api.github.com/users/laurmurclar/gists{/gist_id}","starred_url":"https://api.github.com/users/laurmurclar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurmurclar/subscriptions","organizations_url":"https://api.github.com/users/laurmurclar/orgs","repos_url":"https://api.github.com/users/laurmurclar/repos","events_url":"https://api.github.com/users/laurmurclar/events{/privacy}","received_events_url":"https://api.github.com/users/laurmurclar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-18T08:45:45Z","updated_at":"2016-08-18T08:45:45Z","closed_at":null,"body":"In our application, we have a pretty specific case where if one particular whitelisted reducer changes, we want to add another whitelisted reducer to `storesToProcess`. \r\n\r\nFor more context, we have two states that look a bit like \r\n```\r\nA: { id: 123 }\r\nB: { items: {123: {name: 'Lucy', etc... }, 124: { name:.. }}, otherItems: ...}\r\n```\r\n\r\nB gets populated before A, but we only want to store the part of B identified by A. We have a custom serialiser that has some code like:\r\n\r\n```\r\n...\r\nif ( key === 'B') {\r\n  const object = { items: {} }\r\n  object.items[store.A.id] = store.B.items[store.A.id];\r\n  return JSON.stringify(object);\r\n}\r\n...\r\n```\r\nHowever, since B updates before A, `store.A.id` is undefined at the point when B updates. When A updates, the state of B has not changed (`lastState[key] === state[key]`) and so B isn't added to `storesToProcess`, ie. the transform isn't called for state B. \r\n\r\nWe will be overwriting the `createPersistor` function to make sure the two reducers get updated.  Do you think it would be useful to include this option for everyone? My plan is to pass in a list of linked reducers in the config and then if the key is in that list, to also check if any of the states of the other keys in the list have changed. I'd be happy to create a PR for this if other people find it useful. "}}
{"actor":{"display_login":"laurmurclar"}}