{"action":"closed","number":27,"pull_request":{"url":"https://api.github.com/repos/traveloka/soya-form/pulls/27","id":191732539,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxNzMyNTM5","html_url":"https://github.com/traveloka/soya-form/pull/27","diff_url":"https://github.com/traveloka/soya-form/pull/27.diff","patch_url":"https://github.com/traveloka/soya-form/pull/27.patch","issue_url":"https://api.github.com/repos/traveloka/soya-form/issues/27","number":27,"state":"closed","locked":false,"title":"[FEATURE] Add HOC for injecting formValues","user":{"login":"fawwaz","id":1295143,"node_id":"MDQ6VXNlcjEyOTUxNDM=","avatar_url":"https://avatars3.githubusercontent.com/u/1295143?v=4","gravatar_id":"","url":"https://api.github.com/users/fawwaz","html_url":"https://github.com/fawwaz","followers_url":"https://api.github.com/users/fawwaz/followers","following_url":"https://api.github.com/users/fawwaz/following{/other_user}","gists_url":"https://api.github.com/users/fawwaz/gists{/gist_id}","starred_url":"https://api.github.com/users/fawwaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fawwaz/subscriptions","organizations_url":"https://api.github.com/users/fawwaz/orgs","repos_url":"https://api.github.com/users/fawwaz/repos","events_url":"https://api.github.com/users/fawwaz/events{/privacy}","received_events_url":"https://api.github.com/users/fawwaz/received_events","type":"User","site_admin":false},"body":"# Background\r\nCurrently, if you want to retrieve soya form value, you should call `this.props.form.submit`\r\nSometimes you want to retrieve the form values without calling `this.props.form.submit` for example , you want to change some dropdown options based on another dropdown value : \r\n![teaser](https://user-images.githubusercontent.com/1295143/40781014-8f589fca-6504-11e8-98a0-9e7d0ae0af46.gif)\r\n\r\n# Proposal / Design\r\nI want to introduce a new HOC (withFormValues) which accept 2 parameter\r\n\r\n1. FORM_ID : form id to be listened\r\n2. Array of FieldNames. (Including nested field)\r\n\r\n# How to use\r\nnow it is very convenient if you have some props which always listen for every form value like this : \r\n```\r\nconst options = {\r\n  MAIN: [\r\n    { value: 'FIRST', label: 'Load Number Options' },\r\n    { value: 'SECOND', label: 'Load Alphabet options' },\r\n    { value: 'THIRD', label: 'Load Emoji options' },\r\n  ],\r\n  FIRST: [\r\n    { value: '1', label: '1' },\r\n    { value: '2', label: '2' },\r\n    { value: '3', label: '3' },\r\n  ],\r\n  SECOND: [\r\n    { value: 'A', label: 'A' },\r\n    { value: 'B', label: 'B' },\r\n    { value: 'C', label: 'C' },\r\n  ],\r\n  THIRD: [\r\n    { value: 'emoji1', label: '😀' },\r\n    { value: 'emoji2', label: '😛' },\r\n    { value: 'emoji3', label: '😵' },\r\n  ],\r\n}\r\n\r\nclass PageContent extends React.Component {\r\n\r\n  render() {\r\n\r\n    // listen for value changes\r\n    const { formValues } = this.props;\r\n    const optionsForSecondField = options[formValues.firstField]\r\n\r\n    return (\r\n      <div>\r\n        Which options should I load ? <br />\r\n        <SelectField name=\"firstField\" options={options.MAIN} />\r\n        Now, what is the option <br />\r\n        <SelectField name=\"secondField\" options={optionsForSecondField} />\r\n      </div>\r\n    );\r\n  }\r\n}\r\n\r\nexport default createPage()(\r\n  compose(\r\n    applyReducers(reducer),\r\n    withFormValues(FORM_ID, ['firstField', 'secondField'])\r\n  )(PageContent)\r\n);\r\n```\r\n\r\n# CAVEATS\r\nEvery props changes means react will re-render the component. --> Performance ?","created_at":"2018-05-31T12:04:43Z","updated_at":"2018-08-15T04:58:36Z","closed_at":"2018-08-15T04:58:36Z","merged_at":"2018-08-15T04:58:36Z","merge_commit_sha":"a7dacd1140713fca6c1ffe7d044a6724a12c8a9b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/traveloka/soya-form/pulls/27/commits","review_comments_url":"https://api.github.com/repos/traveloka/soya-form/pulls/27/comments","review_comment_url":"https://api.github.com/repos/traveloka/soya-form/pulls/comments{/number}","comments_url":"https://api.github.com/repos/traveloka/soya-form/issues/27/comments","statuses_url":"https://api.github.com/repos/traveloka/soya-form/statuses/0e6a0507a8fda4420f668751d1472a169721a7fb","head":{"label":"fawwaz:feature/withFormValuesHOC","ref":"feature/withFormValuesHOC","sha":"0e6a0507a8fda4420f668751d1472a169721a7fb","user":{"login":"fawwaz","id":1295143,"node_id":"MDQ6VXNlcjEyOTUxNDM=","avatar_url":"https://avatars3.githubusercontent.com/u/1295143?v=4","gravatar_id":"","url":"https://api.github.com/users/fawwaz","html_url":"https://github.com/fawwaz","followers_url":"https://api.github.com/users/fawwaz/followers","following_url":"https://api.github.com/users/fawwaz/following{/other_user}","gists_url":"https://api.github.com/users/fawwaz/gists{/gist_id}","starred_url":"https://api.github.com/users/fawwaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fawwaz/subscriptions","organizations_url":"https://api.github.com/users/fawwaz/orgs","repos_url":"https://api.github.com/users/fawwaz/repos","events_url":"https://api.github.com/users/fawwaz/events{/privacy}","received_events_url":"https://api.github.com/users/fawwaz/received_events","type":"User","site_admin":false},"repo":{"id":106987604,"node_id":"MDEwOlJlcG9zaXRvcnkxMDY5ODc2MDQ=","name":"soya-form","full_name":"fawwaz/soya-form","owner":{"login":"fawwaz","id":1295143,"node_id":"MDQ6VXNlcjEyOTUxNDM=","avatar_url":"https://avatars3.githubusercontent.com/u/1295143?v=4","gravatar_id":"","url":"https://api.github.com/users/fawwaz","html_url":"https://github.com/fawwaz","followers_url":"https://api.github.com/users/fawwaz/followers","following_url":"https://api.github.com/users/fawwaz/following{/other_user}","gists_url":"https://api.github.com/users/fawwaz/gists{/gist_id}","starred_url":"https://api.github.com/users/fawwaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fawwaz/subscriptions","organizations_url":"https://api.github.com/users/fawwaz/orgs","repos_url":"https://api.github.com/users/fawwaz/repos","events_url":"https://api.github.com/users/fawwaz/events{/privacy}","received_events_url":"https://api.github.com/users/fawwaz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fawwaz/soya-form","description":"React form library for soya","fork":true,"url":"https://api.github.com/repos/fawwaz/soya-form","forks_url":"https://api.github.com/repos/fawwaz/soya-form/forks","keys_url":"https://api.github.com/repos/fawwaz/soya-form/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fawwaz/soya-form/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fawwaz/soya-form/teams","hooks_url":"https://api.github.com/repos/fawwaz/soya-form/hooks","issue_events_url":"https://api.github.com/repos/fawwaz/soya-form/issues/events{/number}","events_url":"https://api.github.com/repos/fawwaz/soya-form/events","assignees_url":"https://api.github.com/repos/fawwaz/soya-form/assignees{/user}","branches_url":"https://api.github.com/repos/fawwaz/soya-form/branches{/branch}","tags_url":"https://api.github.com/repos/fawwaz/soya-form/tags","blobs_url":"https://api.github.com/repos/fawwaz/soya-form/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fawwaz/soya-form/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fawwaz/soya-form/git/refs{/sha}","trees_url":"https://api.github.com/repos/fawwaz/soya-form/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fawwaz/soya-form/statuses/{sha}","languages_url":"https://api.github.com/repos/fawwaz/soya-form/languages","stargazers_url":"https://api.github.com/repos/fawwaz/soya-form/stargazers","contributors_url":"https://api.github.com/repos/fawwaz/soya-form/contributors","subscribers_url":"https://api.github.com/repos/fawwaz/soya-form/subscribers","subscription_url":"https://api.github.com/repos/fawwaz/soya-form/subscription","commits_url":"https://api.github.com/repos/fawwaz/soya-form/commits{/sha}","git_commits_url":"https://api.github.com/repos/fawwaz/soya-form/git/commits{/sha}","comments_url":"https://api.github.com/repos/fawwaz/soya-form/comments{/number}","issue_comment_url":"https://api.github.com/repos/fawwaz/soya-form/issues/comments{/number}","contents_url":"https://api.github.com/repos/fawwaz/soya-form/contents/{+path}","compare_url":"https://api.github.com/repos/fawwaz/soya-form/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fawwaz/soya-form/merges","archive_url":"https://api.github.com/repos/fawwaz/soya-form/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fawwaz/soya-form/downloads","issues_url":"https://api.github.com/repos/fawwaz/soya-form/issues{/number}","pulls_url":"https://api.github.com/repos/fawwaz/soya-form/pulls{/number}","milestones_url":"https://api.github.com/repos/fawwaz/soya-form/milestones{/number}","notifications_url":"https://api.github.com/repos/fawwaz/soya-form/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fawwaz/soya-form/labels{/name}","releases_url":"https://api.github.com/repos/fawwaz/soya-form/releases{/id}","deployments_url":"https://api.github.com/repos/fawwaz/soya-form/deployments","created_at":"2017-10-15T05:56:39Z","updated_at":"2017-10-15T05:56:40Z","pushed_at":"2018-08-15T04:49:22Z","git_url":"git://github.com/fawwaz/soya-form.git","ssh_url":"git@github.com:fawwaz/soya-form.git","clone_url":"https://github.com/fawwaz/soya-form.git","svn_url":"https://github.com/fawwaz/soya-form","homepage":"","size":223,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"traveloka:master","ref":"master","sha":"408c3bec458d3e01f699930a7808c761cfc25421","user":{"login":"traveloka","id":1683964,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2ODM5NjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1683964?v=4","gravatar_id":"","url":"https://api.github.com/users/traveloka","html_url":"https://github.com/traveloka","followers_url":"https://api.github.com/users/traveloka/followers","following_url":"https://api.github.com/users/traveloka/following{/other_user}","gists_url":"https://api.github.com/users/traveloka/gists{/gist_id}","starred_url":"https://api.github.com/users/traveloka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/traveloka/subscriptions","organizations_url":"https://api.github.com/users/traveloka/orgs","repos_url":"https://api.github.com/users/traveloka/repos","events_url":"https://api.github.com/users/traveloka/events{/privacy}","received_events_url":"https://api.github.com/users/traveloka/received_events","type":"Organization","site_admin":false},"repo":{"id":93667750,"node_id":"MDEwOlJlcG9zaXRvcnk5MzY2Nzc1MA==","name":"soya-form","full_name":"traveloka/soya-form","owner":{"login":"traveloka","id":1683964,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2ODM5NjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1683964?v=4","gravatar_id":"","url":"https://api.github.com/users/traveloka","html_url":"https://github.com/traveloka","followers_url":"https://api.github.com/users/traveloka/followers","following_url":"https://api.github.com/users/traveloka/following{/other_user}","gists_url":"https://api.github.com/users/traveloka/gists{/gist_id}","starred_url":"https://api.github.com/users/traveloka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/traveloka/subscriptions","organizations_url":"https://api.github.com/users/traveloka/orgs","repos_url":"https://api.github.com/users/traveloka/repos","events_url":"https://api.github.com/users/traveloka/events{/privacy}","received_events_url":"https://api.github.com/users/traveloka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/traveloka/soya-form","description":"React form library for soya","fork":false,"url":"https://api.github.com/repos/traveloka/soya-form","forks_url":"https://api.github.com/repos/traveloka/soya-form/forks","keys_url":"https://api.github.com/repos/traveloka/soya-form/keys{/key_id}","collaborators_url":"https://api.github.com/repos/traveloka/soya-form/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/traveloka/soya-form/teams","hooks_url":"https://api.github.com/repos/traveloka/soya-form/hooks","issue_events_url":"https://api.github.com/repos/traveloka/soya-form/issues/events{/number}","events_url":"https://api.github.com/repos/traveloka/soya-form/events","assignees_url":"https://api.github.com/repos/traveloka/soya-form/assignees{/user}","branches_url":"https://api.github.com/repos/traveloka/soya-form/branches{/branch}","tags_url":"https://api.github.com/repos/traveloka/soya-form/tags","blobs_url":"https://api.github.com/repos/traveloka/soya-form/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/traveloka/soya-form/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/traveloka/soya-form/git/refs{/sha}","trees_url":"https://api.github.com/repos/traveloka/soya-form/git/trees{/sha}","statuses_url":"https://api.github.com/repos/traveloka/soya-form/statuses/{sha}","languages_url":"https://api.github.com/repos/traveloka/soya-form/languages","stargazers_url":"https://api.github.com/repos/traveloka/soya-form/stargazers","contributors_url":"https://api.github.com/repos/traveloka/soya-form/contributors","subscribers_url":"https://api.github.com/repos/traveloka/soya-form/subscribers","subscription_url":"https://api.github.com/repos/traveloka/soya-form/subscription","commits_url":"https://api.github.com/repos/traveloka/soya-form/commits{/sha}","git_commits_url":"https://api.github.com/repos/traveloka/soya-form/git/commits{/sha}","comments_url":"https://api.github.com/repos/traveloka/soya-form/comments{/number}","issue_comment_url":"https://api.github.com/repos/traveloka/soya-form/issues/comments{/number}","contents_url":"https://api.github.com/repos/traveloka/soya-form/contents/{+path}","compare_url":"https://api.github.com/repos/traveloka/soya-form/compare/{base}...{head}","merges_url":"https://api.github.com/repos/traveloka/soya-form/merges","archive_url":"https://api.github.com/repos/traveloka/soya-form/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/traveloka/soya-form/downloads","issues_url":"https://api.github.com/repos/traveloka/soya-form/issues{/number}","pulls_url":"https://api.github.com/repos/traveloka/soya-form/pulls{/number}","milestones_url":"https://api.github.com/repos/traveloka/soya-form/milestones{/number}","notifications_url":"https://api.github.com/repos/traveloka/soya-form/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/traveloka/soya-form/labels{/name}","releases_url":"https://api.github.com/repos/traveloka/soya-form/releases{/id}","deployments_url":"https://api.github.com/repos/traveloka/soya-form/deployments","created_at":"2017-06-07T18:39:57Z","updated_at":"2018-07-25T10:54:27Z","pushed_at":"2018-08-15T04:58:36Z","git_url":"git://github.com/traveloka/soya-form.git","ssh_url":"git@github.com:traveloka/soya-form.git","clone_url":"https://github.com/traveloka/soya-form.git","svn_url":"https://github.com/traveloka/soya-form","homepage":"https://codesandbox.io/s/nwrz79jv7m","size":197,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":6,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/traveloka/soya-form/pulls/27"},"html":{"href":"https://github.com/traveloka/soya-form/pull/27"},"issue":{"href":"https://api.github.com/repos/traveloka/soya-form/issues/27"},"comments":{"href":"https://api.github.com/repos/traveloka/soya-form/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/traveloka/soya-form/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/traveloka/soya-form/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/traveloka/soya-form/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/traveloka/soya-form/statuses/0e6a0507a8fda4420f668751d1472a169721a7fb"}},"author_association":"MEMBER","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"sayuti-daniel","id":28084599,"node_id":"MDQ6VXNlcjI4MDg0NTk5","avatar_url":"https://avatars2.githubusercontent.com/u/28084599?v=4","gravatar_id":"","url":"https://api.github.com/users/sayuti-daniel","html_url":"https://github.com/sayuti-daniel","followers_url":"https://api.github.com/users/sayuti-daniel/followers","following_url":"https://api.github.com/users/sayuti-daniel/following{/other_user}","gists_url":"https://api.github.com/users/sayuti-daniel/gists{/gist_id}","starred_url":"https://api.github.com/users/sayuti-daniel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sayuti-daniel/subscriptions","organizations_url":"https://api.github.com/users/sayuti-daniel/orgs","repos_url":"https://api.github.com/users/sayuti-daniel/repos","events_url":"https://api.github.com/users/sayuti-daniel/events{/privacy}","received_events_url":"https://api.github.com/users/sayuti-daniel/received_events","type":"User","site_admin":false},"comments":10,"review_comments":0,"maintainer_can_modify":false,"commits":10,"additions":1202,"deletions":12,"changed_files":11}}
{"actor":{"display_login":"sayuti-daniel"}}