Closed
Bug 1467401
Opened 7 years ago
Closed 7 years ago
Convert lodash .groupBy() to native ES6 JS
Categories
(Tree Management :: Treeherder: Frontend, defect, P3)
Tree Management
Treeherder: Frontend
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: evct, Assigned: evct)
References
Details
Attachments
(1 file, 1 obsolete file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.170 Safari/537.36 OPR/53.0.2907.68
Steps to reproduce:
Converting all _.groupBy() (lodash) functions to native .filter() (ES6 JS)
Updated•7 years ago
|
Assignee: nobody → oss
Blocks: 1466494
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P3
Comment 1•7 years ago
|
||
Updated•7 years ago
|
Attachment #8984092 -
Flags: review?(cdawson)
Assignee | ||
Comment 2•7 years ago
|
||
Typo in my original comment: "Converting all _.groupBy() (lodash) functions to native ES6 JS".
(I don't know how to edit comment)
Comment 3•7 years ago
|
||
Unfortunately Bugzilla doesn't support editing comments at the moment (bug 540) - the typo doesn't matter too much since it's mainly the bug title and PR/commit titles that will be read.
Unrelated, but myself and Cameron have this Bugzilla component in our watch list, so adding the CCs isn't needed, if you'd rather save time by skipping that step :-)
Assignee | ||
Comment 4•7 years ago
|
||
Ok thanks for the information, and I will skip this step in the future
Comment 5•7 years ago
|
||
Commit pushed to master at https://github.com/mozilla/treeherder
https://github.com/mozilla/treeherder/commit/899396651714e9454946396ecd124db128fabc8d
Bug 1467401 - convert _.groupBy() usages to ES6 (#3629)
Updated•7 years ago
|
Attachment #8984092 -
Flags: review?(cdawson) → review+
Updated•7 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Comment 6•7 years ago
|
||
When I visit stage (https://treeherder.allizom.org/#/jobs?repo=mozilla-inbound) I get:
TypeError: "R.repos is undefined"
getOrderedRepoGroups https://treeherder.allizom.org/index.593ea103062eb159bdc8.bundle.js:31:7795
fn https://treeherder.allizom.org/vendor.bf21b3a1381cc2dcd328.bundle.js line 45 > Function:4:153
...
...which I think is from:
https://github.com/mozilla/treeherder/commit/899396651714e9454946396ecd124db128fabc8d#diff-46e683ff6ffab8c2ca1bdf9d1bd2bb00R36
The ES6 equivalent for _.groupBy() is also pretty verbose. I'm wondering if we should leave that one as is for now, or even see if we can adjust the repo groups data structure so it doesn't need such transformation?
Status: RESOLVED → REOPENED
Flags: needinfo?(cdawson)
Resolution: FIXED → ---
Assignee | ||
Comment 7•7 years ago
|
||
Ok I totally missed this error but indeed I'm having the same behavior on my side... Looking into it.
I'm not used to the code base and the various data structure of Treeherder yet, but that may be a good idea.
Assignee | ||
Comment 8•7 years ago
|
||
In fact `$rootScope.repos` is not filled instantly (slight loading delay I guess), so the very first calls of `getOrderedRepoGroups()` won't do anything since `$rootScope.repos` will be set as undefined.
Then the next calls of getOrderedRepoGroups() actually work because `$rootScope.repos` has been filled with the repos.
_.groupBy() ignored this case, while the ES6 equivalent I wrote fails if the collection on which we apply .reduce() is undefined.
A possible solution could be to first check if `$rootScope.repos` is not undefined. I can submit a patch if it's ok with you.
Comment 9•7 years ago
|
||
Dang, my sincere apologies for not catching this. I must have neglected to have the console window open when testing this.
Ed's point about restructuring the repos structure. I'm happy to look into doing this when I convert the nav bars to React.
I'll revert this for now.
Flags: needinfo?(cdawson)
Comment 10•7 years ago
|
||
Comment 11•7 years ago
|
||
Comment on attachment 8984698 [details] [review]
Link to GitHub pull-request: https://github.com/mozilla/treeherder/pull/3643
(Obsoleting since bug 1468533 is taking a different approach)
Attachment #8984698 -
Attachment is obsolete: true
Updated•7 years ago
|
Status: REOPENED → RESOLVED
Closed: 7 years ago → 7 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•