{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/wp-calypso/issues/27415","repository_url":"https://api.github.com/repos/Automattic/wp-calypso","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/27415/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/27415/comments","events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/27415/events","html_url":"https://github.com/Automattic/wp-calypso/pull/27415","id":363445370,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3ODgwNDY2","number":27415,"title":"Experiment: async load reducers and persist state in parts","user":{"login":"jsnajdr","id":664258,"node_id":"MDQ6VXNlcjY2NDI1OA==","avatar_url":"https://avatars3.githubusercontent.com/u/664258?v=4","gravatar_id":"","url":"https://api.github.com/users/jsnajdr","html_url":"https://github.com/jsnajdr","followers_url":"https://api.github.com/users/jsnajdr/followers","following_url":"https://api.github.com/users/jsnajdr/following{/other_user}","gists_url":"https://api.github.com/users/jsnajdr/gists{/gist_id}","starred_url":"https://api.github.com/users/jsnajdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsnajdr/subscriptions","organizations_url":"https://api.github.com/users/jsnajdr/orgs","repos_url":"https://api.github.com/users/jsnajdr/repos","events_url":"https://api.github.com/users/jsnajdr/events{/privacy}","received_events_url":"https://api.github.com/users/jsnajdr/received_events","type":"User","site_admin":false},"labels":[{"id":285010017,"node_id":"MDU6TGFiZWwyODUwMTAwMTc=","url":"https://api.github.com/repos/Automattic/wp-calypso/labels/[Status]%20In%20Progress","name":"[Status] In Progress","color":"207de5","default":false}],"state":"open","locked":false,"assignee":{"login":"jsnajdr","id":664258,"node_id":"MDQ6VXNlcjY2NDI1OA==","avatar_url":"https://avatars3.githubusercontent.com/u/664258?v=4","gravatar_id":"","url":"https://api.github.com/users/jsnajdr","html_url":"https://github.com/jsnajdr","followers_url":"https://api.github.com/users/jsnajdr/followers","following_url":"https://api.github.com/users/jsnajdr/following{/other_user}","gists_url":"https://api.github.com/users/jsnajdr/gists{/gist_id}","starred_url":"https://api.github.com/users/jsnajdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsnajdr/subscriptions","organizations_url":"https://api.github.com/users/jsnajdr/orgs","repos_url":"https://api.github.com/users/jsnajdr/repos","events_url":"https://api.github.com/users/jsnajdr/events{/privacy}","received_events_url":"https://api.github.com/users/jsnajdr/received_events","type":"User","site_admin":false},"assignees":[{"login":"jsnajdr","id":664258,"node_id":"MDQ6VXNlcjY2NDI1OA==","avatar_url":"https://avatars3.githubusercontent.com/u/664258?v=4","gravatar_id":"","url":"https://api.github.com/users/jsnajdr","html_url":"https://github.com/jsnajdr","followers_url":"https://api.github.com/users/jsnajdr/followers","following_url":"https://api.github.com/users/jsnajdr/following{/other_user}","gists_url":"https://api.github.com/users/jsnajdr/gists{/gist_id}","starred_url":"https://api.github.com/users/jsnajdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsnajdr/subscriptions","organizations_url":"https://api.github.com/users/jsnajdr/orgs","repos_url":"https://api.github.com/users/jsnajdr/repos","events_url":"https://api.github.com/users/jsnajdr/events{/privacy}","received_events_url":"https://api.github.com/users/jsnajdr/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2018-09-25T07:30:10Z","updated_at":"2018-11-21T15:04:16Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/27415","html_url":"https://github.com/Automattic/wp-calypso/pull/27415","diff_url":"https://github.com/Automattic/wp-calypso/pull/27415.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/27415.patch"},"body":"**Adding a new reducer**\r\nPatching `combineReducers` and adding a store enhancer helps us to add a new reducer to any point in the tree:\r\n```js\r\nstore.addReducer( [ 'extensions', 'woocommerce' ], wooReducer );\r\n```\r\n\r\n**Serializing any subtree into separate IndexedDB rows**\r\nDecorate your reducer with `withStorageKey`:\r\n```js\r\nexport default withStorageKey( 'woocommerce', wooReducer );\r\n```\r\nand pass it to `combineReducers` as any other reducer.\r\n\r\nWhen serializing, the state will be stored into multiple IndexedDB rows:\r\n```\r\nredux-state-123:root -> state without woo\r\nredux-state-123:woocommerce -> the woo subtree alone\r\n```\r\n\r\n**Add reducers in extension entrypoint**\r\nMigrate the `woocommerce` and `wpSuperCache` reducers to this new system. Exclude them from `extensions-loader` and load the reducers in extension entrypoint.\r\n\r\n**TODO: deserialize the state at the right moment**\r\nLoad the `woocommerce` state from IndexedDB just in time, add a new reducer with deserialized state. Note that persistence makes adding a new reducer an inherently async operation."},"comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments/440695685","html_url":"https://github.com/Automattic/wp-calypso/pull/27415#issuecomment-440695685","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/27415","id":440695685,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDY5NTY4NQ==","user":{"login":"jsnajdr","id":664258,"node_id":"MDQ6VXNlcjY2NDI1OA==","avatar_url":"https://avatars3.githubusercontent.com/u/664258?v=4","gravatar_id":"","url":"https://api.github.com/users/jsnajdr","html_url":"https://github.com/jsnajdr","followers_url":"https://api.github.com/users/jsnajdr/followers","following_url":"https://api.github.com/users/jsnajdr/following{/other_user}","gists_url":"https://api.github.com/users/jsnajdr/gists{/gist_id}","starred_url":"https://api.github.com/users/jsnajdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsnajdr/subscriptions","organizations_url":"https://api.github.com/users/jsnajdr/orgs","repos_url":"https://api.github.com/users/jsnajdr/repos","events_url":"https://api.github.com/users/jsnajdr/events{/privacy}","received_events_url":"https://api.github.com/users/jsnajdr/received_events","type":"User","site_admin":false},"created_at":"2018-11-21T15:04:16Z","updated_at":"2018-11-21T15:04:16Z","author_association":"CONTRIBUTOR","body":":tada: All unit tests are green for the first time today :tada: The work on the code is almost finished, now we need to review and merge all the small parts."}}
{"actor":{"display_login":"jsnajdr"}}