{"action":"created","comment":{"url":"https://api.github.com/repos/reactioncommerce/reaction/pulls/comments/210594411","pull_request_review_id":146841334,"id":210594411,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDU5NDQxMQ==","diff_hunk":"@@ -0,0 +1,60 @@\n+import React from \"react\";\n+import { PropTypes } from \"prop-types\";\n+import { Query } from \"react-apollo\";\n+import getTags from \"../queries/getTags\";\n+import { getTagIds } from \"/lib/selectors/tags\";\n+\n+export default (Component) => (\n+  class Tags extends React.Component {\n+    static propTypes = {\n+      shouldSkipGraphql: PropTypes.bool, // Whether to skip this HOC's GraphQL query & data\n+    };\n+\n+    render() {\n+      const { shouldSkipGraphql, shopId } = this.props;\n+\n+      if (shouldSkipGraphql || !shopId) {\n+        return (\n+          <Component {...this.props} />\n+        );\n+      }\n+\n+      const variables = {\n+        shopId,\n+        isTopLevel: true\n+      };\n+\n+      return (\n+        <Query query={getTags} variables={variables}>\n+          {({ loading, error, data }) => {\n+            const props = {\n+              ...this.props,\n+              isLoadingTags: loading\n+            };\n+\n+            if (loading === false && data) {\n+              let { tags: { nodes: tags} } = data;\n+              // tags = _.cloneDeep(tags);\n+              _.sortBy(tags, this.props.sortBy || \"position\"); // puts tags without position at end of array\n+              const tagsByKey = {};","path":"imports/plugins/core/graphql/lib/hocs/withTags.js","position":39,"original_position":39,"commit_id":"d7727258e24dc6ebb53bbc1de7f1314b352fca07","original_commit_id":"d7727258e24dc6ebb53bbc1de7f1314b352fca07","user":{"login":"dancastellon","id":849570,"node_id":"MDQ6VXNlcjg0OTU3MA==","avatar_url":"https://avatars3.githubusercontent.com/u/849570?v=4","gravatar_id":"","url":"https://api.github.com/users/dancastellon","html_url":"https://github.com/dancastellon","followers_url":"https://api.github.com/users/dancastellon/followers","following_url":"https://api.github.com/users/dancastellon/following{/other_user}","gists_url":"https://api.github.com/users/dancastellon/gists{/gist_id}","starred_url":"https://api.github.com/users/dancastellon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dancastellon/subscriptions","organizations_url":"https://api.github.com/users/dancastellon/orgs","repos_url":"https://api.github.com/users/dancastellon/repos","events_url":"https://api.github.com/users/dancastellon/events{/privacy}","received_events_url":"https://api.github.com/users/dancastellon/received_events","type":"User","site_admin":false},"body":"@Akarshit I looked into this a little more. I see how a few components like `tagGroup` and `tagGroupBody` take `tagIds` and `tagsByKey` props. Those components could probably be reworked to just accept `tags[]` since with ES6 you an now do `tag = tags.find(tag => tag._id === tagId)`. Take a look and see if it's relatively straightforward to change. If it's a pain, then maybe leave `tagsByKey` in this HOC. Otherwise, would be nice to clean the components up a little. Up to you :)","created_at":"2018-08-16T13:26:39Z","updated_at":"2018-08-16T13:26:48Z","html_url":"https://github.com/reactioncommerce/reaction/pull/4551#discussion_r210594411","pull_request_url":"https://api.github.com/repos/reactioncommerce/reaction/pulls/4551","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/reactioncommerce/reaction/pulls/comments/210594411"},"html":{"href":"https://github.com/reactioncommerce/reaction/pull/4551#discussion_r210594411"},"pull_request":{"href":"https://api.github.com/repos/reactioncommerce/reaction/pulls/4551"}},"in_reply_to_id":210577559},"pull_request":{"url":"https://api.github.com/repos/reactioncommerce/reaction/pulls/4551","id":208766960,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4NzY2OTYw","html_url":"https://github.com/reactioncommerce/reaction/pull/4551","diff_url":"https://github.com/reactioncommerce/reaction/pull/4551.diff","patch_url":"https://github.com/reactioncommerce/reaction/pull/4551.patch","issue_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/4551","number":4551,"state":"open","locked":false,"title":"[WIP] Refactor NavBar to use GraphQL queries.","user":{"login":"Akarshit","id":7762605,"node_id":"MDQ6VXNlcjc3NjI2MDU=","avatar_url":"https://avatars0.githubusercontent.com/u/7762605?v=4","gravatar_id":"","url":"https://api.github.com/users/Akarshit","html_url":"https://github.com/Akarshit","followers_url":"https://api.github.com/users/Akarshit/followers","following_url":"https://api.github.com/users/Akarshit/following{/other_user}","gists_url":"https://api.github.com/users/Akarshit/gists{/gist_id}","starred_url":"https://api.github.com/users/Akarshit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Akarshit/subscriptions","organizations_url":"https://api.github.com/users/Akarshit/orgs","repos_url":"https://api.github.com/users/Akarshit/repos","events_url":"https://api.github.com/users/Akarshit/events{/privacy}","received_events_url":"https://api.github.com/users/Akarshit/received_events","type":"User","site_admin":false},"body":"Resolves\r\nImpact: **minor**  \r\nType: **refactor**\r\n\r\n## Issue\r\nCurrently the NavBar gets all its data from Meteor. This is a hurdle for removal of Meteor from the app.\r\n\r\n## Solution\r\n- Spilt the TagNav into 1 separate components for customer and admin. In the customer component I am fetching the data from GraphQL queries. \r\n  - I have changed the code to pass only the required props to child component instead of passing `{...this.props}`, this will prevent a lot of confusion.\r\n  - Nothing has been modified on Admin side.\r\n  - Removed all the admin code from the customer's component.\r\n\r\n## Testing\r\n1. Login as admin and create a few tags and sub-tags.\r\n2. Change the order of the tags by dragging them.\r\n3. Create a few products and assign them these tags.\r\n4. Log out and as a customer check that the tags are correctly ordered.\r\n5. Check that clicking on any tag shows you the respective products.\r\n6. Check that hovering over a tag with sub-tags should display those sub-tags.","created_at":"2018-08-16T07:22:33Z","updated_at":"2018-08-16T13:26:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b7a5996bb549137f696207a891062fb74d0c275","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/reactioncommerce/reaction/pulls/4551/commits","review_comments_url":"https://api.github.com/repos/reactioncommerce/reaction/pulls/4551/comments","review_comment_url":"https://api.github.com/repos/reactioncommerce/reaction/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/4551/comments","statuses_url":"https://api.github.com/repos/reactioncommerce/reaction/statuses/d7727258e24dc6ebb53bbc1de7f1314b352fca07","head":{"label":"reactioncommerce:refactor-akarshit-navbar","ref":"refactor-akarshit-navbar","sha":"d7727258e24dc6ebb53bbc1de7f1314b352fca07","user":{"login":"reactioncommerce","id":5605462,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2MDU0NjI=","avatar_url":"https://avatars0.githubusercontent.com/u/5605462?v=4","gravatar_id":"","url":"https://api.github.com/users/reactioncommerce","html_url":"https://github.com/reactioncommerce","followers_url":"https://api.github.com/users/reactioncommerce/followers","following_url":"https://api.github.com/users/reactioncommerce/following{/other_user}","gists_url":"https://api.github.com/users/reactioncommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/reactioncommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactioncommerce/subscriptions","organizations_url":"https://api.github.com/users/reactioncommerce/orgs","repos_url":"https://api.github.com/users/reactioncommerce/repos","events_url":"https://api.github.com/users/reactioncommerce/events{/privacy}","received_events_url":"https://api.github.com/users/reactioncommerce/received_events","type":"Organization","site_admin":false},"repo":{"id":12926963,"node_id":"MDEwOlJlcG9zaXRvcnkxMjkyNjk2Mw==","name":"reaction","full_name":"reactioncommerce/reaction","owner":{"login":"reactioncommerce","id":5605462,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2MDU0NjI=","avatar_url":"https://avatars0.githubusercontent.com/u/5605462?v=4","gravatar_id":"","url":"https://api.github.com/users/reactioncommerce","html_url":"https://github.com/reactioncommerce","followers_url":"https://api.github.com/users/reactioncommerce/followers","following_url":"https://api.github.com/users/reactioncommerce/following{/other_user}","gists_url":"https://api.github.com/users/reactioncommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/reactioncommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactioncommerce/subscriptions","organizations_url":"https://api.github.com/users/reactioncommerce/orgs","repos_url":"https://api.github.com/users/reactioncommerce/repos","events_url":"https://api.github.com/users/reactioncommerce/events{/privacy}","received_events_url":"https://api.github.com/users/reactioncommerce/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reactioncommerce/reaction","description":"Reaction is a customizable, real-time reactive, JavaScript commerce platform.","fork":false,"url":"https://api.github.com/repos/reactioncommerce/reaction","forks_url":"https://api.github.com/repos/reactioncommerce/reaction/forks","keys_url":"https://api.github.com/repos/reactioncommerce/reaction/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reactioncommerce/reaction/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reactioncommerce/reaction/teams","hooks_url":"https://api.github.com/repos/reactioncommerce/reaction/hooks","issue_events_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/events{/number}","events_url":"https://api.github.com/repos/reactioncommerce/reaction/events","assignees_url":"https://api.github.com/repos/reactioncommerce/reaction/assignees{/user}","branches_url":"https://api.github.com/repos/reactioncommerce/reaction/branches{/branch}","tags_url":"https://api.github.com/repos/reactioncommerce/reaction/tags","blobs_url":"https://api.github.com/repos/reactioncommerce/reaction/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reactioncommerce/reaction/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reactioncommerce/reaction/git/refs{/sha}","trees_url":"https://api.github.com/repos/reactioncommerce/reaction/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reactioncommerce/reaction/statuses/{sha}","languages_url":"https://api.github.com/repos/reactioncommerce/reaction/languages","stargazers_url":"https://api.github.com/repos/reactioncommerce/reaction/stargazers","contributors_url":"https://api.github.com/repos/reactioncommerce/reaction/contributors","subscribers_url":"https://api.github.com/repos/reactioncommerce/reaction/subscribers","subscription_url":"https://api.github.com/repos/reactioncommerce/reaction/subscription","commits_url":"https://api.github.com/repos/reactioncommerce/reaction/commits{/sha}","git_commits_url":"https://api.github.com/repos/reactioncommerce/reaction/git/commits{/sha}","comments_url":"https://api.github.com/repos/reactioncommerce/reaction/comments{/number}","issue_comment_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/comments{/number}","contents_url":"https://api.github.com/repos/reactioncommerce/reaction/contents/{+path}","compare_url":"https://api.github.com/repos/reactioncommerce/reaction/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reactioncommerce/reaction/merges","archive_url":"https://api.github.com/repos/reactioncommerce/reaction/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reactioncommerce/reaction/downloads","issues_url":"https://api.github.com/repos/reactioncommerce/reaction/issues{/number}","pulls_url":"https://api.github.com/repos/reactioncommerce/reaction/pulls{/number}","milestones_url":"https://api.github.com/repos/reactioncommerce/reaction/milestones{/number}","notifications_url":"https://api.github.com/repos/reactioncommerce/reaction/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reactioncommerce/reaction/labels{/name}","releases_url":"https://api.github.com/repos/reactioncommerce/reaction/releases{/id}","deployments_url":"https://api.github.com/repos/reactioncommerce/reaction/deployments","created_at":"2013-09-18T15:30:36Z","updated_at":"2018-08-16T07:36:29Z","pushed_at":"2018-08-16T07:22:34Z","git_url":"git://github.com/reactioncommerce/reaction.git","ssh_url":"git@github.com:reactioncommerce/reaction.git","clone_url":"https://github.com/reactioncommerce/reaction.git","svn_url":"https://github.com/reactioncommerce/reaction","homepage":"https://reactioncommerce.com/","size":49920,"stargazers_count":7516,"watchers_count":7516,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1416,"mirror_url":null,"archived":false,"open_issues_count":399,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":1416,"open_issues":399,"watchers":7516,"default_branch":"master"}},"base":{"label":"reactioncommerce:release-1.15.0","ref":"release-1.15.0","sha":"75cd5af4475406ee0a05ff48b08df92f997af189","user":{"login":"reactioncommerce","id":5605462,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2MDU0NjI=","avatar_url":"https://avatars0.githubusercontent.com/u/5605462?v=4","gravatar_id":"","url":"https://api.github.com/users/reactioncommerce","html_url":"https://github.com/reactioncommerce","followers_url":"https://api.github.com/users/reactioncommerce/followers","following_url":"https://api.github.com/users/reactioncommerce/following{/other_user}","gists_url":"https://api.github.com/users/reactioncommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/reactioncommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactioncommerce/subscriptions","organizations_url":"https://api.github.com/users/reactioncommerce/orgs","repos_url":"https://api.github.com/users/reactioncommerce/repos","events_url":"https://api.github.com/users/reactioncommerce/events{/privacy}","received_events_url":"https://api.github.com/users/reactioncommerce/received_events","type":"Organization","site_admin":false},"repo":{"id":12926963,"node_id":"MDEwOlJlcG9zaXRvcnkxMjkyNjk2Mw==","name":"reaction","full_name":"reactioncommerce/reaction","owner":{"login":"reactioncommerce","id":5605462,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2MDU0NjI=","avatar_url":"https://avatars0.githubusercontent.com/u/5605462?v=4","gravatar_id":"","url":"https://api.github.com/users/reactioncommerce","html_url":"https://github.com/reactioncommerce","followers_url":"https://api.github.com/users/reactioncommerce/followers","following_url":"https://api.github.com/users/reactioncommerce/following{/other_user}","gists_url":"https://api.github.com/users/reactioncommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/reactioncommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactioncommerce/subscriptions","organizations_url":"https://api.github.com/users/reactioncommerce/orgs","repos_url":"https://api.github.com/users/reactioncommerce/repos","events_url":"https://api.github.com/users/reactioncommerce/events{/privacy}","received_events_url":"https://api.github.com/users/reactioncommerce/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reactioncommerce/reaction","description":"Reaction is a customizable, real-time reactive, JavaScript commerce platform.","fork":false,"url":"https://api.github.com/repos/reactioncommerce/reaction","forks_url":"https://api.github.com/repos/reactioncommerce/reaction/forks","keys_url":"https://api.github.com/repos/reactioncommerce/reaction/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reactioncommerce/reaction/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reactioncommerce/reaction/teams","hooks_url":"https://api.github.com/repos/reactioncommerce/reaction/hooks","issue_events_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/events{/number}","events_url":"https://api.github.com/repos/reactioncommerce/reaction/events","assignees_url":"https://api.github.com/repos/reactioncommerce/reaction/assignees{/user}","branches_url":"https://api.github.com/repos/reactioncommerce/reaction/branches{/branch}","tags_url":"https://api.github.com/repos/reactioncommerce/reaction/tags","blobs_url":"https://api.github.com/repos/reactioncommerce/reaction/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reactioncommerce/reaction/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reactioncommerce/reaction/git/refs{/sha}","trees_url":"https://api.github.com/repos/reactioncommerce/reaction/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reactioncommerce/reaction/statuses/{sha}","languages_url":"https://api.github.com/repos/reactioncommerce/reaction/languages","stargazers_url":"https://api.github.com/repos/reactioncommerce/reaction/stargazers","contributors_url":"https://api.github.com/repos/reactioncommerce/reaction/contributors","subscribers_url":"https://api.github.com/repos/reactioncommerce/reaction/subscribers","subscription_url":"https://api.github.com/repos/reactioncommerce/reaction/subscription","commits_url":"https://api.github.com/repos/reactioncommerce/reaction/commits{/sha}","git_commits_url":"https://api.github.com/repos/reactioncommerce/reaction/git/commits{/sha}","comments_url":"https://api.github.com/repos/reactioncommerce/reaction/comments{/number}","issue_comment_url":"https://api.github.com/repos/reactioncommerce/reaction/issues/comments{/number}","contents_url":"https://api.github.com/repos/reactioncommerce/reaction/contents/{+path}","compare_url":"https://api.github.com/repos/reactioncommerce/reaction/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reactioncommerce/reaction/merges","archive_url":"https://api.github.com/repos/reactioncommerce/reaction/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reactioncommerce/reaction/downloads","issues_url":"https://api.github.com/repos/reactioncommerce/reaction/issues{/number}","pulls_url":"https://api.github.com/repos/reactioncommerce/reaction/pulls{/number}","milestones_url":"https://api.github.com/repos/reactioncommerce/reaction/milestones{/number}","notifications_url":"https://api.github.com/repos/reactioncommerce/reaction/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reactioncommerce/reaction/labels{/name}","releases_url":"https://api.github.com/repos/reactioncommerce/reaction/releases{/id}","deployments_url":"https://api.github.com/repos/reactioncommerce/reaction/deployments","created_at":"2013-09-18T15:30:36Z","updated_at":"2018-08-16T07:36:29Z","pushed_at":"2018-08-16T07:22:34Z","git_url":"git://github.com/reactioncommerce/reaction.git","ssh_url":"git@github.com:reactioncommerce/reaction.git","clone_url":"https://github.com/reactioncommerce/reaction.git","svn_url":"https://github.com/reactioncommerce/reaction","homepage":"https://reactioncommerce.com/","size":49920,"stargazers_count":7516,"watchers_count":7516,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1416,"mirror_url":null,"archived":false,"open_issues_count":399,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":1416,"open_issues":399,"watchers":7516,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reactioncommerce/reaction/pulls/4551"},"html":{"href":"https://github.com/reactioncommerce/reaction/pull/4551"},"issue":{"href":"https://api.github.com/repos/reactioncommerce/reaction/issues/4551"},"comments":{"href":"https://api.github.com/repos/reactioncommerce/reaction/issues/4551/comments"},"review_comments":{"href":"https://api.github.com/repos/reactioncommerce/reaction/pulls/4551/comments"},"review_comment":{"href":"https://api.github.com/repos/reactioncommerce/reaction/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reactioncommerce/reaction/pulls/4551/commits"},"statuses":{"href":"https://api.github.com/repos/reactioncommerce/reaction/statuses/d7727258e24dc6ebb53bbc1de7f1314b352fca07"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dancastellon"}}