{"action":"created","issue":{"url":"https://api.github.com/repos/thecartercenter/nemo/issues/663","repository_url":"https://api.github.com/repos/thecartercenter/nemo","labels_url":"https://api.github.com/repos/thecartercenter/nemo/issues/663/labels{/name}","comments_url":"https://api.github.com/repos/thecartercenter/nemo/issues/663/comments","events_url":"https://api.github.com/repos/thecartercenter/nemo/issues/663/events","html_url":"https://github.com/thecartercenter/nemo/pull/663","id":516368249,"node_id":"MDExOlB1bGxSZXF1ZXN0MzM1NjM0NTM5","number":663,"title":"10267 fix group condition issue [hotfix]","user":{"login":"cooperka","id":2047062,"node_id":"MDQ6VXNlcjIwNDcwNjI=","avatar_url":"https://avatars2.githubusercontent.com/u/2047062?v=4","gravatar_id":"","url":"https://api.github.com/users/cooperka","html_url":"https://github.com/cooperka","followers_url":"https://api.github.com/users/cooperka/followers","following_url":"https://api.github.com/users/cooperka/following{/other_user}","gists_url":"https://api.github.com/users/cooperka/gists{/gist_id}","starred_url":"https://api.github.com/users/cooperka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cooperka/subscriptions","organizations_url":"https://api.github.com/users/cooperka/orgs","repos_url":"https://api.github.com/users/cooperka/repos","events_url":"https://api.github.com/users/cooperka/events{/privacy}","received_events_url":"https://api.github.com/users/cooperka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"smoyth","id":702320,"node_id":"MDQ6VXNlcjcwMjMyMA==","avatar_url":"https://avatars1.githubusercontent.com/u/702320?v=4","gravatar_id":"","url":"https://api.github.com/users/smoyth","html_url":"https://github.com/smoyth","followers_url":"https://api.github.com/users/smoyth/followers","following_url":"https://api.github.com/users/smoyth/following{/other_user}","gists_url":"https://api.github.com/users/smoyth/gists{/gist_id}","starred_url":"https://api.github.com/users/smoyth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smoyth/subscriptions","organizations_url":"https://api.github.com/users/smoyth/orgs","repos_url":"https://api.github.com/users/smoyth/repos","events_url":"https://api.github.com/users/smoyth/events{/privacy}","received_events_url":"https://api.github.com/users/smoyth/received_events","type":"User","site_admin":false},"assignees":[{"login":"smoyth","id":702320,"node_id":"MDQ6VXNlcjcwMjMyMA==","avatar_url":"https://avatars1.githubusercontent.com/u/702320?v=4","gravatar_id":"","url":"https://api.github.com/users/smoyth","html_url":"https://github.com/smoyth","followers_url":"https://api.github.com/users/smoyth/followers","following_url":"https://api.github.com/users/smoyth/following{/other_user}","gists_url":"https://api.github.com/users/smoyth/gists{/gist_id}","starred_url":"https://api.github.com/users/smoyth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smoyth/subscriptions","organizations_url":"https://api.github.com/users/smoyth/orgs","repos_url":"https://api.github.com/users/smoyth/repos","events_url":"https://api.github.com/users/smoyth/events{/privacy}","received_events_url":"https://api.github.com/users/smoyth/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2019-11-01T21:59:49Z","updated_at":"2019-11-01T22:37:13Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/thecartercenter/nemo/pulls/663","html_url":"https://github.com/thecartercenter/nemo/pull/663","diff_url":"https://github.com/thecartercenter/nemo/pull/663.diff","patch_url":"https://github.com/thecartercenter/nemo/pull/663.patch"},"body":"Repro steps:\r\n- Go to a form with multiple groups, including one at the root e.g. https://staging.getelmo.org/en/admin/forms/5e38b7c5-1f04-48f6-95e2-3d0946214abb/edit\r\n- Click to edit the first group\r\n- Close modal, then click to edit second group\r\n- Note the Name field is correct but the Display Logic field is wrong\r\n\r\nThis fix is a bit hacky, but it's the simplest solution I could think of given the unusual combination of technology we have in this scenario:\r\n- Rails creating a React component\r\n- React component creating a Mobx store\r\n- Same React component being re-created when the modal goes away and comes back, thus needing to re-create the store as well\r\n\r\nReason it wasn't working:\r\n- When the React component was re-created, it asked for an instance of the store, and was given the old instance of the store from the store cache\r\n- The old code worked just fine on pages that render one instance of each component, but modals are an exception because they go away and come back with different data\r\n- The component in the modal successfully re-rendered, but showed the old store data\r\n\r\nReason the fix works:\r\n- Now there's no store cache; the store is always created from scratch, so the data is correct\r\n\r\nReason for adding the new nonce:\r\n- When the `DisplayLogicFormField/injector` component is re-created from scratch by Rails, it somehow tries to resume some aspect of its old state, causing Mobx to warn loudly about store replacement **if the store has changed** (the reason for adding the store cache in the first place)\r\n- This resuming of state when completely re-created doesn't seem to be typical React behavior, and is possibly due to some complexity added by the interaction between React/Rails/Mobx\r\n- In order to prevent Mobx from complaining on re-mount, we need to force the component to reset by giving it a **unique key** every time it's mounted by Rails\r\n    - React uses `key` to reconcile the virtual dom; it's an easy and conventional way to tell React \"this component is different than before\"\r\n\r\nPerformance implications:\r\n- Hardly any, because the component should have been doing this in the first place\r\n\r\nSpecs coming momentarily."},"comment":{"url":"https://api.github.com/repos/thecartercenter/nemo/issues/comments/548973584","html_url":"https://github.com/thecartercenter/nemo/pull/663#issuecomment-548973584","issue_url":"https://api.github.com/repos/thecartercenter/nemo/issues/663","id":548973584,"node_id":"MDEyOklzc3VlQ29tbWVudDU0ODk3MzU4NA==","user":{"login":"cooperka","id":2047062,"node_id":"MDQ6VXNlcjIwNDcwNjI=","avatar_url":"https://avatars2.githubusercontent.com/u/2047062?v=4","gravatar_id":"","url":"https://api.github.com/users/cooperka","html_url":"https://github.com/cooperka","followers_url":"https://api.github.com/users/cooperka/followers","following_url":"https://api.github.com/users/cooperka/following{/other_user}","gists_url":"https://api.github.com/users/cooperka/gists{/gist_id}","starred_url":"https://api.github.com/users/cooperka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cooperka/subscriptions","organizations_url":"https://api.github.com/users/cooperka/orgs","repos_url":"https://api.github.com/users/cooperka/repos","events_url":"https://api.github.com/users/cooperka/events{/privacy}","received_events_url":"https://api.github.com/users/cooperka/received_events","type":"User","site_admin":false},"created_at":"2019-11-01T22:37:13Z","updated_at":"2019-11-01T22:37:13Z","author_association":"MEMBER","body":"Only failing spec is \"joe batt's arm\" because now there are 2 locations returned by geocoding api instead of 1 🤕 releasing this as hotfix!"}}
{"actor":{"display_login":"cooperka"}}